Something for your amusement:


#! /usr/local/bin/perl -w
    eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
        if 0; #$running_under_some_shell

use strict;
use warnings;

use File::Find ();

use vars qw/*name *dir *prune @targets/;
*name   = *File::Find::name;
*dir    = *File::Find::dir;
*prune  = *File::Find::prune;

sub wanted;

File::Find::find({wanted => \&wanted}, '.');

sub wanted {
    my ($dev,$ino,$mode,$nlink,$uid,$gid);

push @targets, (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
                                                           -f _ &&
                                             /^.+/s &&
                                               sprintf("%s",$name);

# or other patterns ...
# /^.*\.t.*gz\z/s
# /^Makefile\.PL\z/s

}

# Do something with targets -
foreach (@targets) {
    print "$_\n";
}

__END__

As an alternative - you could set it up to pass Perl regular expressions as a file pattern matcher using "shift" .

--
_Sx_ http://youve-reached-the.endoftheinternet.org/ _____
     http://jaxpm.insecurity.org/
     http://cis4dl.insecurity.org/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to