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

Re^4: Programming in Perl without semicolon

by JavaFan (Canon)
on Jan 31, 2009 at 10:20 UTC ( [id://740403]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Programming in Perl without semicolon
in thread Programming in Perl without semicolon

Unfortunally, it's not a general technique. It works here because 'fib(0)' is supposed to return '0'; the block isn't executed if the argument of the function is 0.
But it can be written as:
local our ($n, $m) = (shift, 0)) && do { }
and then it will always do the 'do'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found