On Thu, Feb 27, 2003 at 01:43:13PM -0500, Carlton Lo wrote:
>       I'm new to perl, I'm trying to write a pl script that would open a gzipped txt 
> file. Is there any functions where I can call for this. I've tried the followings:
> 
> method #1     open(IN, "gunzip -c data.gz") || die "cannot open input data file";

open(IN, "gunzip -c data.gz|") || die "cannot open input data file. $!";



> method #2     pass the filename as ARGV and execute the script as $perl test.pl 
> 'gunzip -c data.gz'

cat > test.pl
open(F, "$ARGV[0]|") or die "Cannot open $ARGV[0]. $!\n";
^D

Note the pipe (|) at the end of the second argument to open.
    
    perldoc -f open

Either method will suffice, though #2 is rather strange.

-Gyepi

-- 
Science is organized knowledge. Wisdom is organized life.
        --Immanuel Kant  
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to