Re: [code-review] Bencode.pm

Andrew Savige <ajsavige-/[email protected]> Fri, 3 Oct 2003 12:06:06 +1000 (EST)
Newsgroups gmane.comp.lang.perl.code-review-ladder
Message-ID <[email protected]>
Tony Bowden wrote:
> On Thu, Oct 02, 2003 at 01:30:16PM +1000, Andrew Savige wrote:
>> Not sure if this helps you, but you can tell if a Perl value is a string
>> or a number by exploiting that bitwise operators operate differently on
>> numbers and strings.
>
> Or by using Scalar::Util::looks_like_number...

Scalar::Util::looks_like_number may be an alternative to the OP's regex,
but it cannot tell the difference between $x="123" and $y=123; $x and $y
both look like a number to looks_like_number. I think Data::Dumper and
Storable can tell the difference. Not sure about YAML.

/-\


http://search.yahoo.com.au - Yahoo! Search
- Looking for more? Try the new Yahoo! Search