Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Shift versus Sanity

by mattriff (Chaplain)
on Apr 24, 2002 at 00:22 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://161491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-23 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found