------------------------------------------------
On Thu, 25 Sep 2003 16:03:27 -0500, "JOHN FISHER" <[EMAIL PROTECTED]> wrote:
> I have successfully used zgrep in a script and loved every minute of it (still wet
> behind the ears).
> sub pulldata
> {
> my $data = `zgrep $key $whichfile`;
> print $data;
> }
>
> That command ran thru the whole zip file and dumped all the data, which for that app
> was just one record.
>
> Now I need to read one record at a time from a zip file.
>
> while ( $one_record = `unzip -p zipfile.zip`);
> {
> do stuff with that one_record
> }
>
> I am sure $one_record will have the entire file and it is huge so my server will run
> out of memory. The reason why I want to do this this way is due to disk space
> shortage, so unzipping beforehand it not really an option. Help !
>
Check out the 'Compress::Zlib' module. In particular the 'gzreadline' method. Much
better than shelling out to do this sort of thing...
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]