language: Perl (perl 5.16.2)
date: 180 days 4 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl
# splits.pl
 
use strict;
use warnings;
use diagnostics;
 
while (<>) { # loop through each line in file
 
    next if ($. == 1); # skip first line (contains business segment code)
    next if ($. == 2); # skip second line (contains transaction amount text)
 
    my @fields = split('\t',$_);  # split fields for line into an array     
 
    print scalar(grep $_, @fields), "\n"; 
 
}
  • upload with new input
  • result: Success     time: 0.08s    memory: 6448 kB     returned value: 0

        4   G   I   M   N   U   X
        Transaction Amount  Transaction Amount  Transaction Amount  Transaction Amount  Transaction Amount  Transaction Amount  Transaction Amount
    0000-13-I21             600         
    0001-8V-034BLA              2,172   2,172       
    0001-8V-191GYG                  13,125      4,375
    0001-9W-GH5B2A  -2,967.09       2,967.09    25.00 
    1
    1
    1
    1