Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: getting wrong value

by pvaldes (Chaplain)
on Jan 16, 2013 at 00:21 UTC ( #1013474=note: print w/ replies, xml ) Need Help??

in reply to getting wrong value

And you are not calling the function

open(INFILE, '<','test.dat'); open(OUTFILE, '>','hex.dat'); while(<INFILE>){ chomp; #printf ("%#x", $line) > $line2; my $line2 = &capture_stdout($_) ; ### <--- see the & print OUTFILE $line2,"\n"; } sub capture_stdout(){ my $v; local *STDOUT; open(STDOUT, '>', \$v); printf ("%#x", $_); return $v; } close INFILE; close OUTFILE;

In any case you can use pack for this, probably

Comment on Re: getting wrong value
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2015-11-27 14:40 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (730 votes), past polls