> -----Original Message-----
> From: Stuart White [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, 21 February 2004 9:21 AM
> To: Perl Beginners Mailing List
> Subject: lc
> 
> I want to take input from <STDIN> and then convert it
> to lowercase.  so I tried this:
> 
> lc(chomp($input = <STDIN>)));
> 
> and I got an error message that said I couldn't use lc
> in that way - or something like that.  I can't
> remember the message now.

Please *do* remember the message.


lc(chomp($input = <STDIN>)) is broken only because
chomp returns the number of characters chomp'ed, not the
chomped string... easy mistake.  The argument is 
chomp'ed *in place* for performance reasons (at least it
better be, because there's no other good reason for such 
an annoying mis-feature)


chomp($input=<STDIN>)
print lc($input)

should work,  but remember, 'lc()' returns a lowercase copy
of its argument, and does not modify its argument!!

chomp and lc are opposites in this respect.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to