in reply to Re: Is it possible to store an arthimetric operator in a variable?
in thread Is it possible to store an arthimetric operator in a variable?
You shouldn't use prototypes unless necessary, because of their side-effects. In this case, the prototype isn't even being checked because you're using a reference to the function.
sub test($) { print("Boo!\n"); } my $f = \&test; $f->(); # No error. Prints "Boo!". $f->(1, 2, 3); # No error. Prints "Boo!".
And why bother with ?1:0 and ?0:1 since == already returns a boolean value.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Is it possible to store an arthimetric operator in a variable?
by Adam (Vicar) on Jul 19, 2005 at 15:18 UTC | |
by ikegami (Patriarch) on Jul 19, 2005 at 15:22 UTC | |
by Adam (Vicar) on Jul 19, 2005 at 15:23 UTC | |
by benizi (Hermit) on Jul 20, 2005 at 19:17 UTC |