Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Code cleanup; how best to deal with: defined(%hash) is deprecated at...

by NetWallah (Canon)
on May 22, 2014 at 05:29 UTC ( [id://1087058]=note: print w/replies, xml ) Need Help??


in reply to Code cleanup; how best to deal with: defined(%hash) is deprecated at...

Here is an more declarative alternative to do the tests and assignment you show above:
%tags = ( %tags, %{ {l=>\%leftright, r=>\%leftright, t=>\%topbottom, b=>\% +topbottom }->{$position} } );
It will give the right results (with warnings) if any of the expected values is not defined, or incorrect.

        What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
              -Larry Wall, 1992

  • Comment on Re: Code cleanup; how best to deal with: defined(%hash) is deprecated at...
  • Download Code

Replies are listed 'Best First'.
Re^2: Code cleanup; how best to deal with: defined(%hash) is deprecated at...
by taint (Chaplain) on May 23, 2014 at 07:23 UTC
    Hello, NetWallah.

    Thank you very much for taking the time to do that for me. I like it. You're right, and it's alot smaller too. :). I'm afraid I sometimes get so focused, and obsessed on what I'm doing. It's kind of a "Forrest for the Trees" sort of thing. I really need to condition myself to step back, or away from it, more often. :)

    I really appreciate your taking the time to whip that up, for me, NetWallah.

    All the best.

    --Chris

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-18 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found