Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Working with Binary Numbers (nail)

by tye (Sage)
on Sep 25, 2007 at 18:20 UTC ( [id://641009]=note: print w/replies, xml ) Need Help??


in reply to Working with Binary Numbers

use Algorithm::Loops qw( NestedLoops ); my @patterns= qw( 000- 0101 011- 1-0- ); my @bits; for( @patterns ) { my $pattern= $_; # Copy; don't modify @patterns my $count= $pattern =~ s/-/%d/g; push @bits, NestedLoops( [ ([0,1])x$count ], sub { sprintf $pattern, @_ }, ); } print "@bits\n" # prints 0000 0001 0110 0111 1000 1001 1100 1101

If you've got my Hammer.

- tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://641009]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-25 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found