in reply to output binary data
You can use the pack function to create a binary value in a scalar variable, and then write it to the output file. Be sure to use binmode on the file handle so that it won't modify the binary values you send. Something like:
use strict; use warnings; my $foo = 12345; $foo = pack "l", $foo; open my $FH, '>', "foo.bin"; binmode($FH); print $FH $foo; close $FH;
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: output binary data
by morgon (Priest) on Dec 29, 2010 at 07:32 UTC |