Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Push can shove it.

by maverick (Curate)
on Feb 23, 2002 at 00:24 UTC ( [id://147005]=note: print w/replies, xml ) Need Help??


in reply to Push can shove it.

the shift in add2arr only shifts off the FIRST element of the params, in this case the first element of @tmp. If you rewrote add2arr like
sub add2arr { my ($value,@tmp) = @_; push(@tmp,$value); return @tmp; } # and call it like @tmp = add2arr($value,@tmp)
it should work. BUT you shouldn't do this at all. You should do
push(@tmp,$value)
directly inside make_sections.

/\/\averick
perl -l -e "eval pack('h*','072796e6470272f2c5f2c5166756279636b672');"

Replies are listed 'Best First'.
Re: Re: Push can shove it.
by HamNRye (Monk) on Feb 23, 2002 at 00:55 UTC

    Thanks guys, I found the problem.

    It was variable going out of scope that was not detected by use strict or -w.

    BTW, if push(@tmp,$value); had worked initially, I wouldn't have needed to post. You may notice that the sub call is commented out, and there is a lovely (non-working) push statement directly below it.

    The basic debug was just placing everything in its proper scope manually. (You see all of those MAIN:: vars...) ~Hammy

      I call.
      my @args = ( 1 .. 3 ); push @args, 'foo'; print "@args\n";
      If this does not work on your machine, your version of Perl is horribly broken.

      I seriously doubt that to be the case.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-20 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found