xenchu has asked for the wisdom of the Perl Monks concerning the following question:
Suppose you have a regexp:
My question is this: If the items in @list are both upper and lower case how do you make the first letter of selected items Uppercase(or lowercase) for all items? I tried several methods but none worked.@results = map {/.+\/.+\/(.*).pm$/} @list;
Thanks,
xenchu
Update:HyperZonk is correct. The answer I was looking for was the one BrowserUK provided. He was also correct about the errors in my regexp. I did not explain what I was trying to do. @list would contain all the files on my system that ended in .pm. I thought at the time that some of the modules had a lowercase as well as an uppercase version(I was wrong about that too). I was attempting to ensure that the resulting list had no duplicates. That is why the perfectly logical uc(@results) would not have been useful.
Anyway I thank you all. Everytime I ask a question on this site I become a better programmer.
xenchu
Update2:HyperZonk, the reason I don't require anything between the second slash and .pm is that I can't think of anything that fits. It is (or should be) a module name. I think I'll go buy a copy of Simple Regular Expressions for Morons. If it doesn't look too advanced.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Uppercasing Regex Output
by BrowserUk (Patriarch) on Dec 07, 2003 at 20:37 UTC | |
|
Re: Uppercasing Regex Output
by HyperZonk (Friar) on Dec 07, 2003 at 20:44 UTC | |
|
Re: Uppercasing Regex Output
by shenme (Priest) on Dec 07, 2003 at 20:41 UTC | |
|
Re: Uppercasing Regex Output
by pg (Canon) on Dec 07, 2003 at 20:40 UTC | |
|
Re: Uppercasing Regex Output
by duff (Parson) on Dec 07, 2003 at 20:37 UTC |