in reply to Find and change value.

hi,

i suppose you have some file for which you wish to iterate over. so one possible way to go would be

use strict; #use warnings; my @array; my $count = 0; my $count_big = 0; while(<DATA>){ chomp($_); my @arraytmp = split(' ',$_); if ($count == 1){for(1..4){shift(@arraytmp)}} $arraytmp[1]=~ s/M/000000/g if ($count == 1); push(@{$array[$count_big]},@arraytmp); $count++; $count = 0 if ($count == 2); $count_big++ unless ($count); } __DATA__ QR No N/A 1 1 1 0 0 0 0 0 0 QR 1 1 1 0 157M 23:09:15.190448 00:42:28.205336 00:40:04.086054
i think the code is straightforward and should work on large files.

also i would always import the changes after the split to array.

update:

i totally missed the point!

if ($arraytmp[1]=~ s/M//g && $count == 1){$arraytmp[1] *= 1000000}
but i admit that ikegami's solution is more elegant :)