Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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
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 making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2019-04-20 18:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I am most likely to install a new module from CPAN if:
















    Results (110 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!