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

Re: xml - empty node

by Anonymous Monk
on Apr 24, 2013 at 14:09 UTC ( #1030414=note: print w/ replies, xml ) Need Help??


in reply to xml - empty node

read perlintro and length

if( length $foo ){ print 1 } else { print 2 }


Comment on Re: xml - empty node
Re^2: xml - empty node
by Lotus1 (Chaplain) on Apr 24, 2013 at 14:50 UTC

    length() isn't needed here since $foo is the result of $_->to_literal which returns either a string an empty string.

      length() isn't needed here

      sure it is, it clarifies intent

        Then this is even clearer. :)

        if (length $artist > 0){ print "$artist | "; } else { print "0 | "; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2015-07-06 12:51 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 (74 votes), past polls