#!/usr/bin/perl -w @dir_list = @INC; $i = 0; while ($i <= $#dir_list) { $dir = $dir_list[$i]; listPMFile($dir); $i++; } sub listPMFile { my($dir) = $_[0]; my(@list); my($new_dir); my($filename); my($name); if ($dir eq ".") { return; } chdir( $dir ); @list = glob("\*"); foreach $filename (@list) { # Check if file ends with .pm if ($filename =~ /\.pm$/ ) { $name = $filename; $name =~ s/\.pm$//; print "$dir/$name\n"; } # Check if is a directory. if ( -d $filename ) { $new_dir = $dir . "/" . $filename; # Append directory name onto dir list. $pos = $#dir_list + 1; $dir_list[$pos] = $new_dir; } } }