Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Working with text files, thinking my issue is with variables inside if loops

by holli (Monsignor)
on May 24, 2011 at 07:56 UTC ( #906442=note: print w/ replies, xml ) Need Help??


in reply to Re: Working with text files, thinking my issue is with variables inside if loops
in thread Working with text files, thinking my issue is with variables inside if loops

Suboptimal.
while (<FILE>) { next unless /\S/; # Skip whitespace lines if (/^ \s* Daniel \s+ Lastname \s* $/x) { $current_handle = daniels_handle; next; } elsif (/^ \s* Steffi \s+ Lastname \s* $/x) { $current_handle = steffis_handle; next; } print $current_handle $_; }


holli

You can lead your users to water, but alas, you cannot drown them.


Comment on Re^2: Working with text files, thinking my issue is with variables inside if loops
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (16)
As of 2015-07-02 10:31 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 (33 votes), past polls