I love getting the chance to use for()'s on scalars when they make sense. For example, it was nice to be able to do this:
for ($wind_dir) {
s/north/N/ig;
s/south/S/ig;
s/west/W/ig;
s/east/E/ig;
}
in my tooltip weather reporting program. Oh, the little things...
Two problems yet remain though:
Win32::GUI isn't the easiest thing in the world when you're unfamiliar with it.
for($wind_dir){
s/(\w).*/uc($1)/ige;
}
Re:Regex
mothra on 2002-05-03T00:24:07
That's broken, because the wind direction "Northeast" must be turned into "NE".Re:Regex
vsergu on 2002-05-03T14:45:08
Obviously it should be
$wind_dir =~ s/(.)..th?/\U$1/gi;Re:Regex
mothra on 2002-05-03T15:40:44
If your goal is to save lines/characters, sure. For the year down the road when I have to come back and fix something, I'll be happy to leave it the way I have it.:) Re:Regex
vsergu on 2002-05-03T16:39:56
I wasn't serious. Being a TPR golf tournament judge is warping me.