Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Why are elements of my array getting deleted?

by tangent (Curate)
on Apr 18, 2012 at 22:18 UTC ( #965813=note: print w/ replies, xml ) Need Help??


in reply to Why are elements of my array getting deleted?

Not sure if this will work but I would suggest you change how you assign your arguments to:

sub ccmexec_nodie { my $command = shift; ... sub myprint { my $level = shift; my $string = shift;


Comment on Re: Why are elements of my array getting deleted?
Download Code
Replies are listed 'Best First'.
Re^2: Why are elements of my array getting deleted?
by chromatic (Archbishop) on Apr 19, 2012 at 04:06 UTC
    Not sure if this will work...

    What led you to believe it might? (I think you might say "Because I understand that accessing elements of @_ directly exhibits aliasing behavior." Fortunately, assignment of those elements performs a copy of the value of each element, so the only difference between direct assignment of indexed element and shift is that the latter updates the container—@_— as well.)

      What led you to believe it might?
      Because, in a similar scenario, this change fixed a mysterious problem I had. I don't have the knowledge to explain why, but it did work.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-29 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls