--- Eugene van der Pijll <[EMAIL PROTECTED]> wrote:
> And on 11 sextil 2002 said Phil Carmody:
> > One way:
> >
> > perl -pe '$_=y/o |./10/d?pack(B8,$_):""'
I'd just realised
perl -pe '$_=y/o |./10/d&&pack(B8,$_)'
works.
> perl -pe '$_=y/|.//d?pack(B8,$_):""'
> perl -ne 'y/|.//d&&print pack B8,$_'
which implies that
perl -pe '$_=y/|.//d&&pack(B8,$_)'
should work too.
:-)
> In perl there are 256 binary digits.
<<<
Likewise, the "b" and "B" fields pack a string
that many bits long. Each byte of the
input field of pack() generates 1 bit of the
result. Each result bit is based on the
least-significant bit of the corresponding
input byte, i.e., on "ord($byte)%2". In par�
ticular, bytes "0" and "1" generate bits 0
and 1, as do bytes "\0" and "\1".
>>>
YLSNED.
So - the reverse direction seems fair game now. It can't be much
longer than
the above, can it?
Ta,
Phil
=====
--
The good Christian should beware of mathematicians, and all those who make
empty prophecies. The danger already exists that the mathematicians have
made a covenant with the devil to darken the spirit and to confine man in
the bonds of Hell. -- Common mistranslation of St. Augustine (354-430)
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com