Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by choroba (Chancellor)
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.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^3: Two simple code style advice questions (my)
by tye (Sage) 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 musing on the Monastery: (8)
As of 2016-09-27 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (509 votes). Check out past polls.