nondescript has asked for the wisdom of the Perl Monks concerning the following question:

$foo = 4096; When I print $foo to a file, Perl prints the string "4096", not the binary value 4096.
  • Comment on How do I write the value of a scalar integer as a Binary value, not a string?

Replies are listed 'Best First'.
Re: How do I write the value of a scalar integer as a Binary value, not a string?
by merlyn (Sage) on Feb 08, 2001 at 06:33 UTC
    Well, once you figure out whether you want it to be big-endian or little-endian, you can use pack to do the job.