in reply to Re^2: Programming in Perl without semicolon
in thread Programming in Perl without semicolon
Bonus: Doesn't confine you to the main namespace!That's only a bonus if you can switch packages without a semicolon. I haven't figured out how, except for the useless:
{package Foo}
I'm surprised this works. I would have expected 'our' to be in effect after the statement, just like 'my'. (If you replace 'local our' with 'my', the code wouldn't compile under 'strict').(local our $n = shift) && do { ... }
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Programming in Perl without semicolon
by ikegami (Patriarch) on Jan 31, 2009 at 18:54 UTC | |
|
Re^4: Programming in Perl without semicolon
by JavaFan (Canon) on Jan 31, 2009 at 10:20 UTC |