Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

(MeowChow) Re: isn't unless ! $c the same than if $c ?

by MeowChow (Vicar)
on Apr 03, 2002 at 23:41 UTC ( #156492=note: print w/replies, xml ) Need Help??


in reply to isn't unless ! $c the same than if $c ?

The recursive return value for the $c == 0 case in both code samples is not properly specified, so the return value is set to the value of the compared expression, !$c in the first case, and $c in the second. What you should have written was something like:
  
perl -le 'sub a{my$c=pop;print $c;$c?$c*a($c-1):1}print a(--$ARGV[0])' + 5
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://156492]
help
Chatterbox?
What's the matter? Cat got your tongue?...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2017-04-24 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (437 votes). Check out past polls.