Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2014-09-23 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (209 votes), past polls