Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Re: Style, style, style

by Anonymous Monk
on Sep 08, 2002 at 03:51 UTC ( #195974=note: print w/replies, xml ) Need Help??

in reply to Re: Style, style, style
in thread Style, style, style

4. my ($foo, $bar) = @_; or my $foo = shift; my $bar = shift;?

What about my ($foo, $bar) = (shift, shift);?

Replies are listed 'Best First'.
Re: Re: Re: Style, style, style
by dws (Chancellor) on Sep 08, 2002 at 03:57 UTC
    What about my ($foo, $bar) = (shift, shift);?

      I regularly see one of these in a co-worker's code:

      sub blah { my ( $foo, $bar, $baz ) = ( shift, shift ); }

      Perhaps not too bad in a short list of shifts. But terrible when invoked as:

      shazam ( 0, 6, 7, $index, $arrayref, $hashref ); ... sub shazam { my ( $foo, $bar, $baz, $bup, $quz, $pig, $cow ) = (shift, shift, shi +ft, shift, shift, shift); }
      Quick, was $cow passed in via @_ or simply instantiated?

      update: added another egregious example, shazam

      setenv EXINIT 'set noai ts=2'

        You might want to at least introduce your co-worker to the wonders of splice: my ($foo, $bar, $baz, $bup, $quz, $pig, $cow) = splice @_, 0, 6;

        Makeshifts last the longest.

Re: Re: Re: Style, style, style
by cybear (Monk) on Sep 10, 2002 at 15:42 UTC
    maybe in Obfuscation, not in production code.

    - cybear

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2021-06-24 09:28 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (124 votes). Check out past polls.