in reply to Re^8: incrementing already existing file
in thread incrementing already existing file
my @fields = ( split /\s+/ ); # need to hold on to all field +s for later my( $index, $label ) = @fields[4, -1]; # this is an array slice
use 5.010; given( $label ) { when ( 'A' ) { $fields[ -2 ] = $x; } when ( 'B' ) { $fields[ -2 ] = $y; } default { say "OOPS! bad label"; } }
say join "\t", @fields; # separates fields with TAB
That's all there is to it. Give it another go and post back with your code if you need more help.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^10: incrementing already existing file
by wanttoprogram (Novice) on Mar 03, 2011 at 06:16 UTC | |
by broomduster (Priest) on Mar 03, 2011 at 13:50 UTC | |
by wanttoprogram (Novice) on Mar 03, 2011 at 16:50 UTC | |
by broomduster (Priest) on Mar 03, 2011 at 17:16 UTC |