Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl-Sensitive Sunglasses
 
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


Comment on (MeowChow) Re: isn't unless ! $c the same than if $c ?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2014-04-19 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (480 votes), past polls