sub do_the_match { my $dir = shift; my ($path, $name) = ($dir =~ /(.*)\/([^\/]*)$/); return ($path, $name); }