Mailinglist Archive: opensuse (2532 mails)
| < Previous | Next > |
Re: [opensuse] Quick Perl Question #2 - Why does chomp($float); = "1"?
- From: Anders Johansson <ajh@xxxxxxxxxx>
- Date: Sat, 3 May 2008 22:24:01 +0200
- Message-id: <200805032224.01595.ajh@xxxxxxxxxx>
On Saturday 03 May 2008 22:13:02 David C. Rankin wrote:
chomp() doesn't return the chomped string, it returns the number of removed
characters (in this case probably just '\n')
Instead, try just
chomp($TEMPC)
and don't assign it
Anders
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
$TEMPC=<STDIN>;
print "\$TEMPC before chomp; $TEMPC\n";
$TEMPC=($TEMPC/1.0); # Works! Removes New Line from Number
#$TEMPC=chomp($TEMPC); # Does not work, returns $TEMPC as "1",
why?
chomp() doesn't return the chomped string, it returns the number of removed
characters (in this case probably just '\n')
Instead, try just
chomp($TEMPC)
and don't assign it
Anders
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |