From what I've read, you would need (&@). '
perldoc perlsub'
The interesting thing about "&" is that you can generate new syntax with
it, provided it's in the initial position:
sub try (&@) {
my($try,$catch) = @_;
eval { &$try };
if ($@) {
local $_ = $@;
&$catch;
}
}
sub catch (&) { $_[0] }
try {
die "phooey";
} catch {
/phooey/ and print "unphooey\n";
};
Although I'm not quite sure it would work.
update: 2006-01-10 00:06:08 PST The prototype magic that allows you to avoid a comma
only works with codeblocks (just like do/grep/map), so I'm pretty sure now that you can't avoid it.
MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" |
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). |
** The third rule of perl club is a statement of fact: pod is sexy. |