Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: foreach loop to untar multiple files

by toolic (Bishop)
on Nov 13, 2015 at 16:26 UTC ( [id://1147671]=note: print w/replies, xml ) Need Help??


in reply to foreach loop to untar multiple files

The problem is that the output of system is the exit value of the ls command, not the output of the ls command. You could use qx to capture the ls command output.

Another approach is to use glob:

my $results = "~/results"; # results coming in. for (glob "$results/*.tar.gz") { system "tar -tvf $_"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2024-04-19 08:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found