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

Re: shift doesnt shift

by jplindstrom (Monsignor)
on Nov 27, 2008 at 13:59 UTC ( #726412=note: print w/replies, xml ) Need Help??

in reply to shift doesnt shift

Is the shift statement inside a subroutine or block of any kind?

If it is, it's shifting off @_ instead of @ARGV.

perldoc -f shift ... If ARRAY is omitted, shifts the @_ array within the lexical scope of subroutines and formats, and the @ARGV array at file scopes ...


Replies are listed 'Best First'.
Re^2: shift doesnt shift
by joec_ (Scribe) on Nov 27, 2008 at 14:04 UTC
    That was it. It was shifting off @_. Thanks.

      Sometimes it pays not to depend on the default targets.

      I've banged my head on similar problems just because I didn't know or misunderstood what was being read.

      So now I always use whatever is needed explicitly, e.g., shift(@ARGV). But that's just me because I basicly suck at programming ;). Not a pro by any means.

        Personally I'm not a big fan of implicit things like that.

        I never use $_ unless I "have to", like in a map, because not naming the variable is a lost opportunity to write clear, self documenting code.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2016-10-26 02:24 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (330 votes). Check out past polls.