in reply to Removing blank lines from array

Or even better as:
my @info = grep { !/^\s*$/ } <READ>; chomp(@info);
Then empty lines (with no whitespace) will be skipped, too

Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

Replies are listed 'Best First'.
•Re: Re: Removing blank lines from array
by merlyn (Sage) on Feb 28, 2002 at 16:53 UTC
      Shouldn't that be:
      my @info; chomp(@info = grep /\S/, <READ>);
      so that @info is accessible later?

      /prakash

        @info will still be visible after the chomp(). There is no enclosing scope there to cause the lexical nature to release the array.

        --rjray