Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 pondering the Monastery: (10)
As of 2016-06-24 21:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (322 votes). Check out past polls.