Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Can't get rid of: Useless use of private variable in void context

by tobias_hofer (Friar)
on Feb 25, 2013 at 10:18 UTC ( #1020489=note: print w/ replies, xml ) Need Help??


in reply to Re: Can't get rid of: Useless use of private variable in void context
in thread Can't get rid of: Useless use of private variable in void context

Yes, much more beautiful!
sadly I still got to use perl 5.10 so local *HTEC... is not working

However, the  ||= 0 version makes the code much more better and makes me get rid of all the if statements!
I will use it that way!
Thanks a lot!

Cheers!

Tobias


Comment on Re^2: Can't get rid of: Useless use of private variable in void context
Select or Download Code
Re^3: Can't get rid of: Useless use of private variable in void context
by Anonymous Monk on Feb 25, 2013 at 10:35 UTC

    sadly I still got to use perl 5.10 so local *HTEC... is not working

    Sure it is, it worked since the very first perl5, at least

    perl -MData::Dump -e" dd $f={2,{4,{6,8}}}; local *H=$$f{2}{4}; dd\%H" { 2 => { 4 => { 6 => 8 } } } { 6 => 8 }
      Hey, you are right! :-)
      Perfect!

      But there is one thing, I have to remove the  use strict;
      else I get a:
      Global symbol "%HTEC" requires explicit package name at...

      Thanks a lot!
      Tobias

        There may be some case where removing "use strict; is a valid approach, but if so, I'm having a hard time thinking of it (not that I tried very hard -- because strict is your friend). Put it back in and find out how to make the hash "legal" (perhaps by declaring it with "my").


        If you didn't program your executable by toggling in binary, it wasn't really programming!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-09-02 13:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (22 votes), past polls