Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: Perl Idioms Explained - my ($foo, $bar) = @{shift(@_)}{qw/ -foo -bar /}

by hardburn (Abbot)
on Apr 13, 2004 at 13:38 UTC ( #344710=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Perl Idioms Explained - my ($foo, $bar) = @{shift(@_)}{qw/ -foo -bar /}
in thread Perl Idioms Explained - my ($foo, $bar) = @{shift(@_)}{qw/ -foo -bar /}

A zero and empty string are (mostly) the same thing as far as Perl is concerned. The only time I worry about ditching undef values is if my interface exlicitly states that undef is different from any other false value. Otherwise you're asking to get a lot of 'use of unintitilized value' warnings.

BTW--I like your @$self{keys %SELF) = @{+shift}{keys %SELF}; example, but it deserves some comments for the poor maintance programmer, who may not have as much Perl-foo as you do.

----
: () { :|:& };:

Note: All code is untested, unless otherwise stated

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://344710]
help
Chatterbox?
[Corion]: Hmmm - I thought we'd made the textarea CSS-sized to 100% a long time ago?!
[Corion]: ... nope, it isn't
[LanX]: heh ... 11.78 popes per square mile ...never thought I might find miles handy
[ambrus]: TCLion: it's to make people write non-short writeups in an external editor and save it to a local file. otherwise people will complain that they had a very insightful extended reply but their browser died just when they were almost ready posting it.
[ww]: ++ambrus "their browser died just when...."
[ambrus]: ww: or they accidentally closed the window, or something. the exact excuse doesn't matter.

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (16)
As of 2017-03-23 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (292 votes). Check out past polls.