Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Handling undefined string content

by Trinary (Pilgrim)
on Jan 31, 2001 at 22:42 UTC ( [id://55527]=note: print w/replies, xml ) Need Help??


in reply to Handling undefined string content

if ($var =~ /^\s+$/) { #do something. }
Explanation: the =~ makes a regular expression bind against a var, instead of $_ / / delimit the regexp. ^ denotes the beginning of a string, $ the end. \s+ means one or more whitespace characters, which is space, \n, \t, \v, or \r. So the whole thing means: do something if, in this var, there's nothing but whitespance between the beginning and end of the contents.

Check out perlre. Regular expressions are good.

Enjoy

Trinary

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found