Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: finding file in a zip file

by Paladin (Priest)
on Jan 31, 2005 at 19:17 UTC ( #426698=note: print w/replies, xml ) Need Help??

in reply to finding file in a zip file

You have your .*$file in single quotes, which means the variable isn't being interpolated, so it's looking for a file that matches zero or more of anything, followed by the dollar sign, followed by the word file. Try changing those to double quotes, and that part will work fine.

As for the rest... The extractToFileNamed() method works on the return values of membersMatching, and not on strings. You probably want something like:

foreach my $archived_file (@files) { $archived_file->extractToFileNamed('some_file_name') or die "Unable to extract data file $! ."; }

Also, $#files gives you the index of the last element, not the number of elements in the array. For that you want my $numfiles = @files

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://426698]
[Discipulus]: hi Tux and good morning you and all!
[Discipulus]: I read about stack size of the tk cb program: have you tried the MCE version? -mce on command line
[msh210]: wow... talk about overkill... seeking a Perl way to split a file by size while ending on a line ending, and only then discovered that split -C will do it

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2017-09-20 06:58 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (234 votes). Check out past polls.