in reply to Parsing a text file

Now that you've gotten answers to your specific question, something general. If you really wanted to store the file in an array, you could replace
#Store the file in an array, split by newlines while (<LOG>){ $string .= $_; } @array = split(/\n/, $string);

with

while (<LOG>){ chomp; push( @array $_ ); }

Replies are listed 'Best First'.
Re^2: Parsing a text file
by moritz (Cardinal) on Apr 16, 2008 at 14:42 UTC
    ... or even with
    my @array = <LOG>; # now remove the newlines at the end: chomp @array;
      ... or even

      chomp( my @array = <LOG> );