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.
In reply to Re^9: incrementing already existing file
by broomduster
in thread incrementing already existing file
by wanttoprogram
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |