in reply to regex switch trouble
I prefer to use the recommended method in the Camel (see also perldoc -q switch):
SWITCH: foreach ($1) { m/^fred$/ && do {$replace_text='wilma'; last SWITCH}; m/^wilma$/ && do {$replace_text='fred'; last SWITCH}; do { die "Unknown check: $_\n" } }
The code doesn't look as elegant as with the switch module, but I have had far fewer problems (and I will try Switch again sometime as I like it in principle).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex switch trouble
by blazar (Canon) on Jun 24, 2007 at 09:52 UTC |