use File::Spec::Functions; $usage = " $0 [] where is part of the name of a class the directory name in which to search for JARs. "; $#ARGV >= 0 or die "$usage"; $pattern = shift; $pattern !~ /([\*\?])/ or die "Cannot use wildcard: $1\n"; if ($dir = shift) { opendir (JARDIR, $dir) or die "Couldn't open $dir: $!\n"; } else { opendir (JARDIR, ".") or die "Can't read current directory: $!"; $dir = "."; } @JARs = grep {/.+\.jar$/} readdir(JARDIR); closedir JARDIR; foreach $jar (@JARs) { $fulljar = catfile($dir, $jar); print "Checking $fulljar ...\n"; @classes = `jar tvf $fulljar`; foreach $class (@classes) { if ($class =~ / (\S*$pattern.*)$/) { $match = $1; $match =~ s:/:.:g; print "$jar: $match\n"; } } }