Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: perl OPEN function and zless

by betterworld (Deacon)
on Jul 14, 2011 at 21:02 UTC ( #914441=note: print w/ replies, xml ) Need Help??


in reply to perl OPEN function and zless

Why would you want to read from zless? It's a pager, which is designed to scroll through a gzipped file (on a terminal). Better choices are 'gunzip' or 'zcat' (maybe look at the man pages).

To use these tools with "open", you need to use "-|" rather than "<". perldoc -f open will tell you more about it.

Searching CPAN for gzip might also help. IO::Uncompress::Gunzip is installed with perl by default.


Comment on Re: perl OPEN function and zless
Replies are listed 'Best First'.
Re^2: perl OPEN function and zless
by legendx (Acolyte) on Jul 15, 2011 at 15:16 UTC
    Thanks,
    I used this to get it to work:
    open(FILE, '-|', "gunzip -c $filename"); while (FILE) { ..do action.. }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://914441]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2015-07-29 01:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls