GertMT has asked for the wisdom of the Perl Monks concerning the following question:
Data#!/usr/bin/perl -w use strict; use warnings; use diagnostics; my %saldi; while (<>) { 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"; } } }
394,eur,2006,D,18.20 394,eur,2006,D,22 394,eur,2006,C,25
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split pattern doesn't match last line of file
by bobf (Monsignor) on Jan 02, 2007 at 05:12 UTC | |
by Util (Priest) on Jan 02, 2007 at 06:12 UTC | |
by GertMT (Hermit) on Jan 02, 2007 at 05:30 UTC | |
by bobf (Monsignor) on Jan 02, 2007 at 05:47 UTC | |
|
Re: Split pattern doesn't match last line of file
by SheridanCat (Pilgrim) on Jan 02, 2007 at 05:37 UTC | |
by GertMT (Hermit) on Jan 02, 2007 at 07:06 UTC | |
|
Re: Split pattern doesn't match last line of file
by graff (Chancellor) on Jan 02, 2007 at 05:05 UTC | |
by GertMT (Hermit) on Jan 02, 2007 at 06:58 UTC | |
by graff (Chancellor) on Jan 03, 2007 at 01:33 UTC |