in reply to Reading arrays
open( DAT, "data.dat" ) or die "Can't open data.dat: $!\n"; my( @left, @right ); while( <DAT> ) { chomp; if( /^block/ ) { push @{$_}, "block" foreach \@left, \@right; next; } my( $left, $right ) = split( /,/ ); foreach( $left, $right ) { s/^\s+//; s/\s+$//; } push @left, $left; push @right, $right; } close( DAT );
|
|---|