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

I realized how I should rephrase my question to be more specific...
Let's say I have the string $result with "Hi, I'm a result." in it.
How do I get Compress::Zlib to take $result in, compress it, and output it not to a file, but to another variable string, say $resultcompressed ? This is what my problem is with understanding Compress::Zlib. If this doesn't work, what other path's do I have to choose from other than taking the output of the file and sending that as a whole chunk?

Confused Russ

Replies are listed 'Best First'.
Re: Compression
by count0 (Friar) on Dec 21, 2001 at 00:59 UTC
    You can use compress() and uncompress().

    As the docs state, this operates 'in-memory' and returns the compressed data. =)

    You would use something to the effect of:
    $compressed_result = compress($result);
      thanks much!! i got what i was working on to work :P
Re: Compression
by Juerd (Abbot) on Dec 21, 2001 at 00:59 UTC
    You didn't even think about reading the documentation, did you?
    It's right there, in the SYNOPSIS-part.

    * sigh *

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

      I did read it, and I didn't understand what it was saying.