in reply to Re^2: Converting Binary Numbers into Binary File
in thread Converting Binary Numbers into Binary File

I'll beat your 41
perl -pe 'BEGIN{binmode STDOUT}chomp;$_=pack"B*",$_'
with 36
perl -pe 'BEGIN{binmode STDOUT}$_=pack"B16",$_'

Replies are listed 'Best First'.
Re^4: Converting Binary Numbers into Binary File
by borisz (Canon) on Sep 14, 2006 at 08:32 UTC
    15 for me ;-)
    perl -C0 -pe '$_=pack"B16",$_'
    Boris
      Oookay - as perl golf rules, you add some switches up front: these count.

      And in what way your STDOUT is guaranteed binmode here? hmm?

      --shmem

      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ----------------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re^4: Converting Binary Numbers into Binary File
by shmem (Chancellor) on Sep 13, 2006 at 20:48 UTC

    Take this:
    perl -e 'binmode STDOUT;print pack"(B16)*",<>'

    36, but without -p :-)

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}