Gabriel Sechan wrote:
From: "Paul G. Allen" <[EMAIL PROTECTED]>
It's been 4 years since I've written in Perl. I'm having a bit of
trouble with pattern matching.
I have a set of strings that are parsed from a file created by
extracting data from a database. Because some of the fields in the
data are empty and some are not, some strings are empty, some not. I
want the code to process all strings that aren't empty. All strings
are NULL terminated.
So far I've managed to have the code either ignore all strings, or
none of them.
What's the correct pattern match for an empty string (the string is
stored in a scalar)?
Not a regex master here, but how about m/^$/
^ for the start of string, $ for end.
That might work. Shortly after writing the e-mail, I remembered that
undef, or NULL, evaluates to false. So,
if( !$String )
would evaluate to TRUE if $String is empty (or NULL, or however you want
to say it).
PGA
--
Paul G. Allen
Owner, Sr. Engineer, Security Specialist
Random Logic/Dream Park
www.randomlogic.com
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list