Richard Heintze wrote:

What if I need more than 32 elements in my bit array?
I suppose I could use the first hidden field for the
first 32 elements of my array and the next 32 elements
are stored in the next hidden field. Uggghhh... Is
there an easier way?

You must not read the regular beginners list?


Lucky you  :) Store it in as many 32 bit numbers
as required and use pack/unpack -

#! /usr/bin/perl
use strict;
use warnings;

my $count;
my $index;
my $str;

while (++$index) {
  $count = $index;

  while(1) {
    (++$count) ? $count += $count--
               : $count += $count++;

    $str = unpack("B32", pack("N", $count));
    print "$count \tis binary $str\n";
    last if $count > 60_000;
    sleep 1;
  }

exit if $index > 255;
}

__END__
-Sx-

PS - Incase you missed the joke -
the ONLY relevant part of this
answer is -

$str = unpack("B32", pack("N", $count));

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to