http://qs321.pair.com?node_id=641003


in reply to Re^6: Working with Binary Numbers
in thread Working with Binary Numbers

Okay, so it's clear I don't understand how blokhead is using glob in this clever way. If I had files in the current directory that looked like one of the bit-vector patterns ("0000", "1-01", etc.) would that break his/her scheme? Can I trouble someone to break down that magic line of his:
my @data = qw( 000- 0101 011- 1-0- ); my @expanded = map { (my $s = $_) =~ s/-/{0,1}/g; glob($s) } @data;
There is a CPAN module Text::Glob that looks like it does what this usage intends, without involving file globbing. The disadvantage is that it takes hundreds of lines to do what blokhead does in one line.

That's Perl though!
Thanks Again!