> then I tried this:
> lc($input);
> and I got the same error.

This shouldn't give an error.  ...It didn't give me one.

> 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.

The exact error would be helpful.

This won't work though because chomp() returns the number of newline
characters removed from the string... so in essence you are trying to
lowercase the number "0" or "1" (the return value of chomp).  ...Not to
mention that you lc() does not modify the scalar passed as an argument (like
chomp does), so you need to store the result of lc().

This is what you want:

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

Rob

-----Original Message-----
From: Stuart White [mailto:[EMAIL PROTECTED]
Sent: Friday, February 20, 2004 5:21 PM
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.

then I tried this:

lc($input);

and I got the same error.

Then I checked my copy of Learning Perl and the index
pointed me to an example of lower case, but it was a
regex example, not a function.  So I thought that
perhaps I had confused two different languages and
that Perl didn't have a lowercase function.

Just now I checked the man pages to see if I really
was not remembering the function for lowercase.  When
I went there, sure enough, lc was there.  

http://www.perldoc.com/perl5.8.0/pod/func/lc.html

The way it is described makes me think that I am using
it correctly, but Perl is telling me different.
So, am I using it incorrectly?  Thanks

__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

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


-- 
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