Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: converting from str to int

by DrHyde (Prior)
on Jul 02, 2014 at 10:00 UTC ( #1091948=note: print w/replies, xml ) Need Help??


in reply to converting from str to int

You're opening the file wrong. Try this:
open(FILE, "-|", "bc < res.txt"); @res=<FILE>; print "@res";

Replies are listed 'Best First'.
Re^2: converting from str to int
by Anonymous Monk on Jul 04, 2014 at 21:16 UTC
    bc may be a good hint, but regarding your wording, there's technically nothing wrong with the way the OP is opening the file. The only thing that might be "wrong" with it is that there's no error checking - which your example doesn't do either. e.g. open(FILE, "-|", "bc < res.txt") or die "failed to pipe: $!";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2022-12-03 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?