in reply to Re^3: pass code block to function (PROTOTYPES)
in thread pass code block to function (PROTOTYPES)
#! /usr/bin/perl -l use strict ; use warnings ; sub try (&@) { my($try,$catch) = @_; eval { &$try }; if ($@) { $catch; } } sub catch (&) { &{$_[0]} } try { die "phooey"; } catch { /phooey/ and print "unphooey\n"; }; __END__ output: Use of uninitialized value in pattern match (m//) at ./tc.pl line 18
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: pass code block to function (PROTOTYPES)
by JavaFan (Canon) on Jul 15, 2009 at 13:04 UTC |