Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Two simple code style advice questions (tye)

by choroba (Abbot)
on Jan 18, 2013 at 09:42 UTC ( #1014001=note: print w/ replies, xml ) Need Help??


in reply to Re: Two simple code style advice questions (tye)
in thread Two simple code style advice questions

Your "funny" example does not work:

# perl -MData::Dumper -e 'my @tests = 1 .. 10; @{ \my %ntests }{ @test +s } = (0) x @tests; print Dumper \%ntests;' $VAR1 = {};
The problem is the my.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re^2: Two simple code style advice questions (tye)
Download Code
Re^3: Two simple code style advice questions (my)
by tye (Cardinal) on Jan 18, 2013 at 15:55 UTC

    Well, I'd say the problem is that @{ } is defined syntactically as containing a full-fledged block (and thus it imposes its own lexical scope).

    @$_{@tests} = (0)x@tests for \my %ntests;

    - tye        

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2014-09-20 00:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls