--- Patrick Diffley <[EMAIL PROTECTED]> wrote: > One way of doing this: > chop ($username); > if ($username eq "") { > ....................... > } > This will at least ensure that a carriage return > is not included in the scalar
'chop' has been so heavily misused that, if I recall correctly, it won't even be in Perl 6. The function you are looking for is 'chomp'. The problem with chop is illustrated by this: while (<IN_FILE>) { chop; print IN_FILE; } That looks innocuous enough, but if the last line of the file does not have a carriage return, you've just chopped off the last letter. 'chomp', on the other hand, merely removes whatever is currently in the $/ variable, which is typically \n. If there is no newline, it removes nothing, leaving data intact. Of course, since 'chop' in this case was reading from STDIN, I don't forsee a problem, but it's still a good idea to avoid. Cheers, Curtis "Ovid" Poe ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]