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

!@#$ $#_

by MeowChow (Vicar)
on Mar 24, 2001 at 22:49 UTC ( #66880=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      sub li {
        shift;
        @_ ? (scalar @_, &li) : ();
      }
      print li qw(a b c d e f g);   # prints 654321
    
  2. or download this
      sub li {
        shift;
        @_ ? ($#_ + 1, &li) : ();
      }
      print li qw(a b c d e f g);   # prints 654321
    
  3. or download this
      sub li {
        shift;
        @_ ? ($#_, &li) : ();
      }
      print li qw(a b c d e f g);   # prints -1-1-1-1-1-1
    
  4. or download this
      use vars '$x';
      sub li {
    ...
        @_ ? ($x, &li) : ();
      }
      print li qw(a b c d e f g);   # prints gggggg
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2015-06-30 09:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What kind of chocolate gives you the most pleasure?















    Results (779 votes), past polls