in reply to Re: Compressing a string, but leaving it as a string
in thread Compressing a string, but leaving it as a string

It seems the compress function cannot handle spaces and digits, etc.

Should the sprintf not always print 7 digits? In that case, I suggest the following compress function:

sub compress {pack'b*',join'',map{sprintf'%07b',ord}split//,pop}

Replies are listed 'Best First'.
Re^3: Compressing a string, but leaving it as a string
by Limbic~Region (Chancellor) on Feb 17, 2011 at 18:26 UTC
    Anonymous Monk,
    Nice catch. As you could probably tell, I posted mostly as a joke and didn't use proper sample data in my testing. I wouldn't use this in any production code.

    Cheers - L~R