in reply to Re: unpack(pack(join simplification
in thread unpack(pack(join simplification
Good idea to use oct(), but $" is deprecated; use join() instead.
sub binary_array_to_uint { my $bin = join '', @_; return oct "0b$bin"; }
perl -wlane 'print oct( "0b" . join( "", @F ) );' <<END 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 END
Output: 2147483648 2147483647 2147483649 1 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: unpack(pack(join simplification
by blazar (Canon) on Jul 04, 2007 at 21:40 UTC |