perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Nicol" <davidni...@gmail.com>
Subject Re: Converting a String of bits into a binary number in perl?
Date Tue, 06 Mar 2007 17:42:49 GMT
>  $a="100";  I want to convert this into perl's interpretation of
> binary no ie $a=0b100

# perl -wple 's/\b([01]+)\b/"0b$1"/gee'
100
4
10111101010101
12117
the powers of 2 are 1, 10, 100, 1000, 10000, 100000
the powers of 2 are 1, 2, 4, 8, 16, 32


-- 
"Big discoveries are protected by public incredulity." -- Marshall McLuhan

Mime
View raw message