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

Re: Can a defined value be of zero length?

by Anonymous Monk
on Apr 19, 2014 at 23:33 UTC ( [id://1082924]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -wMstrict -e 'my $x; print length $x'
    Use of uninitialized value in print at -e line 1.
    $ perl -wMstrict -e 'my $x; print length $x if defined $x'
    $
    
  2. or download this
    $ perl -wMstrict -e 'my $x; print "yes" if $x=~/foo/'
    Use of uninitialized value $x in pattern match (m//) at -e line 1.
    $ perl -wMstrict -e 'my $x; print "yes" if defined $x && $x=~/foo/'
    $
    
  3. or download this
    $ perl -wMstrict -e 'my $x; print "yes" if defined $x && length $x'
    $ perl -wMstrict -e 'my $x; print "yes" if length $x'
    $
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-25 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found