in reply to if or switch?
While I agree that my code isn't the best, I tend to write switches like this (which I learned back in 1995, using perl 4)
SWITCH: for ($mystring) { /key1/ && do { … last SWITCH; }; /key2/ && do { … last SWITCH; }; /key3/ && do { … last SWITCH; }; # default … last SWITCH; }
|
|---|