Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2020-10-25 17:03 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (249 votes). Check out past polls.