Re: The 5.8.0 port anyone?

[email protected] (James Taylor) Wed, 2 Jul 2003 21:05:46 +0100 (BST)
Newsgroups perl.riscos
Message-ID <[email protected]>
On Wed 02 Jul, James Taylor wrote:
> 
> On Wed 02 Jul, Glyn Royds wrote:
> > 
> > It converts a number to binary, padded out to 16 characters with 0's.
> > As something of a perl novice I was about to start writing a routine
> > to do the same
> 
> Well, here's one:
[...snip...]

And if you know it will always be a 16-bit integer
you can use pack/unpack like this:

unpack 'B16', pack 'n', $value;

...which is bound to be quicker than my subroutine solution.

-- 
James Taylor, Cheltenham, Gloucestershire, UK.       PGP key: 3FBE1BF9