LanX has asked for the wisdom of the Perl Monks concerning the following question:

Looking on the hidden treasures of pack and unpack in Re: An array of boolean values in a bitfield, I wonder if there is a template easily allowing a one-line-decompression of strings (e.g. huffman or run-length).

Couldn't find anything except this "w" for BER compression on base 128 (a lot like UTF-8). Did I miss any special feature?

otherwise I need to implement it with RegEx-Translations...

Cheers Rolf

Replies are listed 'Best First'.
Re: Using pack/unpack for compression?
by Corion (Patriarch) on Dec 05, 2008 at 14:59 UTC

    I guess you'll fare better with one of the Compress methods.

      You're absolutely right, if it was for a serious application...

      ... but it's for fun! 8 )

      Would be lovely to deflate an asciigraphic with just one or two commands in the shell.

      Cheers Rolf

      UPDATE: simple example for run-length decoding with RegEx
      DB<93> $_=" /10 20\\10\n<10 8LO2K! 8 >10\n \\10 20/10"; DB<94> s/(.)(\d+)/$1x$2/ge;print ////////// \\\\\\\\\\ <<<<<<<<<< LOOK! >>>>>>>>>> \\\\\\\\\\ //////////