Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013474]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-02-25 18:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (314 votes). Check out past polls.

    Notices?