in reply to Re^2: Split pattern doesn't match last line of file
in thread Split pattern doesn't match last line of file
#!/usr/bin/perl -w use strict; use warnings; use diagnostics; my %saldi; while (<>) { next unless ( /,/ ); ## add this line my @cellen = ( split /,/, )[ 3, 4 ]; $saldi{ $cellen[0] } += $cellen[1]; if ( eof(ARGV) ) { $ARGV =~ m/^(\S+)\.txt/; print "$1\n"; foreach my $name ( keys %saldi ) { print "\t$name\t$saldi{$name}\n"; } } }
|
|---|