Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: 'my' headache...why doesn't this work?

by jeffenstein (Hermit)
on Apr 05, 2002 at 17:05 UTC ( [id://156990]=note: print w/replies, xml ) Need Help??


in reply to 'my' headache...why doesn't this work?

Deparse is your friend.

$ perl -MO=Deparse -e 'my $columnsum += $_->[$colnum] for @data;' foreach $_ (@data) { my $columnsum += $$_[$colnum]; }

The my declaration is within the for loop, so for each @data, a new $columnsum is created.

Update: As demerphq has pointed out, the deparse output is wrong for this snippet. The todo section at the top of B::Deparse even mentions this specifically. Now I'm off to search for what it is really doing...

Update2: A google search for "my $x if 0" returns some answers. There is even a node here in the monestary that talks about it.

Replies are listed 'Best First'.
Re: Re: 'my' headache... Dont Trust Deparse!
by demerphq (Chancellor) on Apr 05, 2002 at 17:48 UTC
    Deparse is wrong.

    See my earlier comments to this thread.

    Yves / DeMerphq
    ---
    Writing a good benchmark isnt as easy as it might look.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found