in reply to Regex Or Die!
I'm not supposed to use unless.I'd say you can use it whenever you want :) Even if I mildly agree with PBP for this issue, I loved Perl also because of unless (even if I use it only as statement modifier, another thing that PBP discourages). Continuing on PBP, why don't you simply negate the if?
Or use the statement modifier (suitable for this one-instruction case)?if (! /^(foo|bar)/) { die "in pain"; }
die "whatever" unless /^(foo|bar)/;
Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex Or Die!
by ChrisCantrall (Sexton) on Sep 27, 2006 at 00:48 UTC | |
|
Re^2: Regex Or Die!
by bart (Canon) on Sep 30, 2006 at 15:00 UTC |