Subject: | Script To Use Compress |
Date: | Tue, 24 Sep 2013 19:07:52 -0400 |
To: | bug-Compress-LZ4 [...] rt.cpan.org |
From: | opticyclic <opticyclic [...] gmail.com> |
Hi,
I'm not really familiar with perl.
How do I create a script to work with it?
My first effort was this but it isn't right.
#!/usr/bin/perl
use Compress::LZ4;
#my $in = $(cat $0);
my $in = `cat $1`;
my $dest = compress(compress($in));
my $file = "temp.zip";
# Use the open() function to create the file.
unless(open FILE, '>'.$file) {
# Die with error message if we can't open it.
die "\nUnable to create $file\n";
}
# Write some text to the file.
#print FILE "Hello there\n";
#print FILE "How are you?\n";
print FILE $dest;
# close the file.
close FILE;
I wanted to pass in the filename to compress to the script and ideally make
the output the same name but with a .lz4 extension but I didn't even get as
far as getting it to work with a fixed output name. Would you be able to
give me an example that works?
Thanks