Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

(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

               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?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2015-07-08 08:01 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (96 votes), past polls