in reply to Smart matching is experimental/depreciated in 5.18 - recommendations?
$\="\n"; for my $foo (qw/abc foo bar 42 unknown/) { eval {goto "_$foo"} or do { print "default"; next; }; _abc: print 'abc'; next; _foo: ; _bar: print "foo bar"; next; _42: print "42"; next; } __END__ abc foo bar foo bar 42 default
plz note, leading underscores only needed for numeric cases...
I don't recommend this over simple if/elsif constructs if performance doesn't matter.
Cheers Rolf
( addicted to the Perl Programming Language)
|
|---|