"John W. Krahn" <[EMAIL PROTECTED]> writes: > #!/usr/bin/perl -w > use strict; > > my %data; > for my $file ( '/data/table1', '/data/table2' ) { > open IN, "< $file" or die "Cannot open $file: $!"; > while ( <IN> ) { > my ( $time, $in, $out ) = split; > $data{ $time }[0] += $in; > $data{ $time }[1] += $out; > } > close IN; > }
Letting the empty diamond operator work on @ARGV would prevent you from having to code the open/close. That's the plus side. The minus side is that you don't have control over the open failure, so you have to be happy with the built-in version. This code is *different*, not *better* --- my %data; @ARGV = qw(/data/table1 /data/table2); while(<>) > my ( $time, $in, $out ) = split; > $data{ $time }[0] += $in; > $data{ $time }[1] += $out; } -- Michael R. Wolf All mammals learn by playing! [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]