The docs clearly state that parameters can not be bare scalars (unless they are file paths, which is not the case for you). Try this:
use IO::Compress::Gzip qw(gzip $GzipError)
# other code...
IO::Compress::Gzip::gzip(\$content, \$newContent) or die "gzip failed:
+ $GzipError\n"
Also, you're doing the file slurp in a wrong and slow way:
my @transferFileContents = <FILE_TO_TRANSFER>;
foreach(@transferFileContents)
{
$content .= $_;
}
It is possible to write this as:
$content = do { local $/; my $rv = <FILE_TO_TRANSFER>; $rv };
which means:
$content = do { # minimize scope
local $/; # make input separator undef 'till the end of this scope
my $rv = <FILE_TO_TRANSFER>; # get all contents
$rv # return it
};
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|