in reply to Re: Changing a number to a string
in thread Changing a number to a string
How would you know if it's being seen as a string or a number, though? Because once you try to test that, Perl will just Do The Right Thing anyway.
$foo = 0; # Declaring as a number if ($foo eq '0') { print "Oops, it's a string!\n"; } $foo = "0"; # Declaring as a string if ($foo == 0) { print "Oops, now it's a number!\n"; }
Bottom line: Perl will always Do The Right Thing when it comes to worrying about stringifying numbers or number-fying strings.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Changing a number to a string
by tye (Sage) on Jan 25, 2001 at 23:33 UTC |