in reply to How can I create a procedure
/smy @procs; my @actions = ([qr/test 1/, sub { thing if true; }], [qr/test 2/, sub { thing if true; }]); for my $x (@actions) { my ($re, $sub) = @$x; if (/$re/) { push @procs, $sub; } } while (<INPUT>) { for my $f (@procs) { $f->($_); } }
|
|---|