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

Re: Push can shove it.

by maverick (Curate)
on Feb 23, 2002 at 00:24 UTC ( #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
Node Status?
node history
Node Type: note [id://147005]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2018-07-16 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (349 votes). Check out past polls.

    Notices?