Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Answer: How do I test for a blank line when reading from a file?

by runrig (Abbot)
on Oct 11, 2000 at 20:52 UTC ( #36247=categorized answer: print w/replies, xml ) Need Help??

Q&A > files > How do I test for a blank line when reading from a file? - Answer contributed by runrig

If by "blank" you mean "empty", then /^$/, as in:
while (<>) { print "blank line detected\n" if /^$/; }

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
zentara ...oO speaking of unicorns and Krishna :-)
[zentara]: Jesus would never bite Ganeesh ! Jesus didn't fight or eat meat
[choroba]: Didn't fight?
[erix]: ganesh in musht?
[LanX]: as a monotheist he would fight other problems
LanX succesfully trolled the CB into religion and leaves now! :)
[erix]: looking for his navel
[choroba]: Cleansing of the Temple
[zentara]: Unicorns are not conceived, they are created. Unicorns don't want another life. :-)
[erix]: you go check your data LanX :P

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (15)
As of 2017-03-30 16:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (361 votes). Check out past polls.