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

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://161491]
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: (7)
As of 2020-11-27 20:10 GMT
Find Nodes?
    Voting Booth?

    No recent polls found