Stuart White wrote: > I want to take input from <STDIN> and then convert it > to lowercase. so I tried this: > > lc(chomp($input = <STDIN>)));
Two things here: 1. It is pointless to lc a numerical value, and the boolean value [1 if a newline was removed, 0 otherwise] returned from chomp will always be expressed as a number. 2. It is pointless to use lc in void context [ie without an lvalue [a variable to the left of an assignment operator] to receive the value. Anytime you get a "void context" warning, make sure that you are assigning the value. This points up an interesting issue, because the problems involved here are two sides of the same coin. The chomp function is a void procedure. It acts on a variable passed in as an argument by reference, and acts directly on the source variable This is why you cannot offer a constant as an argument. There must be a variable for chomp to act on: Greetings! C:\Documents and Settings\rjnewton>perl -w chomp "Hello, world\n"; ^Z Can't modify constant item in chomp at - line 1, near ""Hello, world\n";" Execution of - aborted due to compilation errors. Conversely, lc is a function proper, returning a value in the same sense as mathematical functions. The parameter for this function is taken by value, and the source variable is not modified. Instead, the function *returns* a value representing the string with all upper case aphabetic characters replaced with their lower case equivalents. What you have above could be better written as my $input = <STDIN>; chomp $input; my $l_cased_input = lc $imput; There is no extra charge per line. Seek clarity, not brevity. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>