Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Argument "" Isn't numeric in numeric eq (==)

by karlgoethebier (Abbot)
on Feb 09, 2014 at 16:14 UTC ( [id://1074139]=note: print w/replies, xml ) Need Help??


in reply to Re: Argument "" Isn't numeric in numeric eq (==)
in thread Argument "" Isn't numeric in numeric eq (==)

This looks really cool. But how did you manage it before?

Imho it looks like CSV and the OP needs to do something like my @f = split ',', $data;.

This yields:

$VAR1 = [ '1', '1' ];

And after casting it:

$VAR1 = [ 1, 1 ];

What do i miss (or perhaps yet another mental block)?

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re^3: Argument "" Isn't numeric in numeric eq (==)
by choroba (Cardinal) on Feb 09, 2014 at 16:34 UTC
    I do not understand the question. I just populated the @f array as in the OP. I just used
    while (<DATA>) { my @f = (undef, split /,/);

    as the @f in the OP is not zero based, but one based. There is no need to cast between strings and numbers in Perl.

    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      "There is no need to cast..."

      Yes s(h)ure. I was a bit confused about this Isn't numeric in numeric eq (==). Sorry, i couldn't explain it better :-(

      Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

        The empty strings were the reason of the warning. They are handled by the || 0, because emtpy string is false.
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1074139]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-04-16 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found