in reply to Anonymous sub as error handler
&{ # code here returns a value, # that's interpreted as the name # of the subroutine to call... }
You need something like:
You should ask yourself what you want to do with your example: do you want to define a subroutine, call it or both?my $subroutine = sub { # code here defines an anonymous sub }; $subroutine->( @arguments ); #call sub
In your case, I would just use an unless statement:
Anonymous subs (esp. closures) are of much more use when you need callbacks.unless ($newSeriesSth->execute()) { # error handling }
-- Joost downtime n. The period during which a system is error-free and immune from user input.
|
|---|