Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Shift versus Sanity

by mattriff (Chaplain)
on Apr 24, 2002 at 00:22 UTC ( #161491=note: print w/replies, xml ) Need Help??


in reply to Shift versus Sanity

Okay, since nobody else has said it yet, I will: I like shift(). :) Honestly, I'd never thought of it as possibly being obfuscated until I read this thread.

If I'm working in an OOP module I habitually use shift() to get the object then use @_ for the rest of the parameters, like:

sub object_method { my $self = shift; my ($foo,$bar,$baz) = @_; }

In my mind it's a pretty clean separation of things.

However, I suppose I'll admit that I have been bitten by this (as jeffa asked):

my ($foo,$bar) = shift;

More than once. ;) Usually I get irritated, jump up, amble to the other side of my cubicle wall to interrupt the marketing-type guy (revenge for the 6-7 times he'll be at my desk), head back, look at the code, slap my forehead, fix it, and move on.

- Matt Riffle

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2020-12-03 08:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (53 votes). Check out past polls.

    Notices?