At 11:59 AM 8/14/01 -0400, Drew Cohan wrote:
>1. Any opinions on which is better to convert characters into lowercase
>(efficiency, speed, etc)?
>
>lc vs. tr /A-Z/a-z/ ?
lc can handle locales where upper and lower case isn't the same as A-Z vs a-z.
>2. Is there an option to tell tr to ignore case?
No.
>3. If #2 isn't possible, how would you use lc to convert to lowercase
>before using tr/abc/222/, as in:
I wouldn't.
>while (<>)
>{
> # trying to convert $_ to lowercase using lc before using tr///
> function
> lc;
> tr/abc/222/;
> print;
>}
>
>This code produces an error "Useless use of lc in void context".
lc doesn't modify it's argument, you have to save it somewhere.
> How do I
>successfully combine these three lines of code?
I'd do tr/ABCabc/222222/. Unless I thought I might be in a locale where
the uppercase of abc wasn't ABC. (Anyone know of one?)
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]