use Tie::File; tie my @array, "Tie::File", $filename or die $!; my @tmp = map { $array[ $_ * 2 ] } 0 .. $#array / 2; @array = @tmp;