for( 0b000000000000111111..0b111111000000000000 ) { $_ = sprintf("%018b",$_); next unless /^0*10*10*10*10*10*10*$/; print "$_\n"; }