I was just curious is there was a more elegant way to do this - preferably a single s///, rather than one match and two substitutions. Thanks in advance...This smells a lot like homework, so I'm not posting a full answer -- hints only! In any case I'd also take into account split, and then of course you can join again with '|' (too explicit a hint?!?).
Whatever, there's nothing wrong using two or more statements: it may well be doable with a single s///, but it would just be an exercise in doing it the difficult way. Your code must also be clear, mantainable and easy to understand. Incidentally you may also do
for ($stuff[2]) { s/(?=[A-Z])/U/g; s/(?=[a-z])/L/g; }
In reply to Re: Can anyone make this regex job neater?
by blazar
in thread Can anyone make this regex job neater?
by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |