in reply to Re: binary converter
in thread binary converter
The position shoul be digit :-)
In either case you do not need the index nor the ** operator.
my @digit = reverse split //, $bin; my $num = 0; for my $bit (@digit) { $num = $num * 2 + $bit; } print "\n$num\n";
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: binary converter
by Limbic~Region (Chancellor) on Apr 23, 2013 at 17:25 UTC |