Perl dummy here. I need to use Compress::Zlib > http://www.xav.com/perl/site/lib/Compress/Zlib.html DEFLATE to write the contents of an array i.e "@data" to a .gz file. Been reading the syntax but I'm little lost. Can the $output be a .gz file. Anyone with any suggestions greatly appreciated.
open(GZIP, "|gzip > output.gz") || die("Cannot launch gzip");
print GZIP @files;
close(GZIP);
This doesn't appear to compress the data into a file. Is there any way i can may doing it using a command enclosed in backticks
Ok here goes;
open(FILE1,"file1" ) || die("Cannot Open File1");
open(FILE2, "file2" ) || die("Cannot Open File2");
open(FILE3, "file3" ) || die("Cannot Open File3");
my @files;
my $delimiter = "\del\n";
push(@files, <FILE3>,$test,<FILE2>,$test,<FILE1>);
close (FILE1);
close (FILE2);
close...
I want to write a little piece of perl that will take file1.txt, and file2.txt and concatenate them using /del as the delimiter.
So how would i do this?, read file1.txt, append /del at after last line and then append file2.txt after that.
All suggestions appreciated! Thanks!
With finddepth the syntax says;
use File::Find;
finddepth(\&wanted, @directories_to_search);
sub wanted { ... }
%options
The first argument to "find()" is either a code reference to your
&wanted function, or a hash reference describing the...
Im writing a perl script to delete data based on wether I find certain data. Let me explain. Inside the following dir "/spare/data/sample/" there are 5 levels of 6 directories from A-F like so
so inside /spare/data/sample is
A B C D E F and inside that is the same and so on.
At the very...
I have a test webserver with a directory test for example - http://www.example/test
Im using the .htaccess file and setting "DirectoryIndex om.cgi". om.cgi is a perl script which just returns
a 404 Not found;
#!/usr/bin/perl
#Read request headers
$user_agent = $ENV{"HTTP_USER_AGENT"}...
I have done the following,the logic seems right but it doesn't work;
$content_length = $ENV{"HTTP_CONTENT_LENGTH"};
$method = $ENV{"REQUEST_METHOD"};
if ($method eq "POST")
{
read(STDIN, $buffer, $content_length);
}
open FH, "> /test/doc.txt";
print FH $buffer;
close FH;
}
The file doc.txt...
I have a test webserver, i want to write a script to check what headers are being passed in the request and send back a 302 if all headers are present, but i also want to get the body of what was sent in the request and write it to a file - how do i do this? My code for checking headers...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.