$f->do_this({ '.*\.doc$' => [qw/delete_me 1/], '.*\.xls$' => [qw/copy_to C:\test/], 'dean' => [qw/return_this rel_file|stat_8/], 'F:/dean/ => ['mirror_to', 'C:\test'] }); #### sub do_this { my ($self, $args) = @_; my %hash = %{$args}; while (my ($d, $r) = each (%hash)) { $self->{actions}{$d} = $r; #print "D: $d\nR: @$r\n"; } my $string = undef; map {$string .= $_ . "|"} keys(%{$args}); $string =~ s/\|$//; ##remove the last pipe symbol $string = qr/$string/i; $self->{find} = $string; ## this is the string to match files against #print $self->{find}; } #### if (/$self->{find}/) { my $this = $&; my $matched = ## find pattern used here process($self, $_, $dir, $matched); }