Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

•Re: Re: Removing blank lines from array

by merlyn (Sage)
on Feb 28, 2002 at 16:53 UTC ( #148274=note: print w/ replies, xml ) Need Help??


in reply to Re: Removing blank lines from array
in thread Removing blank lines from array

Or even better-better as:

chomp(my @info = grep /\S/, <READ>);

-- Randal L. Schwartz, Perl hacker


Comment on •Re: Re: Removing blank lines from array
Download Code
Re: •Re: Re: Removing blank lines from array
by PrakashK (Pilgrim) on Feb 28, 2002 at 17:26 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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://148274]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2015-07-05 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (61 votes), past polls