fork(4) download
  1. #!/usr/bin/perl
  2. # splits.pl
  3.  
  4. use strict;
  5. use warnings;
  6. use diagnostics;
  7.  
  8. while (<>) { # loop through each line in file
  9.  
  10. next if ($. == 1); # skip first line (contains business segment code)
  11. next if ($. == 2); # skip second line (contains transaction amount text)
  12.  
  13. my @fields = split('\t',$_); # split fields for line into an array
  14.  
  15. print scalar(grep $_, @fields), "\n";
  16.  
  17. }
Success #stdin #stdout 0.08s 6448KB
stdin
    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 
stdout
1
1
1
1