Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

(crazyinsomniac) Re^2: Always Follow Up on Warnings

by crazyinsomniac (Prior)
on Feb 08, 2002 at 04:00 UTC ( #144026=note: print w/ replies, xml ) Need Help??


in reply to Re: Always Follow Up on Warnings
in thread Always Follow Up on Warnings

Speaking of idioms, I never use one for this type problem, but here is a more idiomatic solution (if u ask me)

#!/usr/bin/perl -wT use strict; my ($x,$y,$z) = (undef,'hello',undef); $_ ||='' for $x,$y,$z; print "x='$x' y='$y' z='$z'\n"; ## OR EVEN (most idiomatic imho) $_||='' for my($a,$b,$c)=(undef,9,undef); print "a='$a' b='$b' c='$c'\n";
Happy Coding!

 
______crazyinsomniac_____________________________
Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"


Comment on (crazyinsomniac) Re^2: Always Follow Up on Warnings
Download Code
Replies are listed 'Best First'.
Re: (crazyinsomniac) Re^2: Always Follow Up on Warnings
by redsquirrel (Hermit) on Feb 08, 2002 at 05:33 UTC
    The problem with $_ ||= '' is that it turns 0's into ''. defined is much less cool, but definitely more effective.

    --Dave

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2015-08-01 03:56 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 (285 votes), past polls