Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^5: (almost) foldl

by Grimy (Pilgrim)
on Jun 08, 2011 at 21:28 UTC ( #908793=note: print w/replies, xml ) Need Help??

in reply to Re^4: (almost) foldl
in thread (almost) foldl

print eval join' + ','1e',6;

Bareword found where operator expected at (eval 1) line 1, near "1e" (Missing operator before e?)

Did this actually test it, or is it because I'm running Perl 5?

Anyway, print eval join'+0+','1e',6; works okay. Plus, the "+0+" looks nice.

Replies are listed 'Best First'.
Re^6: (almost) foldl
by BrowserUk (Pope) on Jun 08, 2011 at 21:34 UTC

    The point is that '1e' is not a valid number in Perl, so your answer of 7 is at best flawed.

    C:\test>perl -Mstrict -wE"say 0+'1e'" Argument "1e" isn't numeric in addition (+) at -e line 1. 1

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Never mind. You're right.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://908793]
and the pool shimmers...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2017-06-22 14:59 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (523 votes). Check out past polls.