Happy Friday Monks! I was wondering how I would pass a regex like this:
(/opt/backups/maindb[0-9]+.db/table[0-9]+.tn/chunk[0-9]+.cn/)
as an argument to a subroutine which executes a command on the (one and only) path matching that regex? Sample below hopefully illustrates what I'm trying to do.
#!/usr/bin/perl -w
use strict;
my $regexStr = qr{[0-9]+};
my $suff = ".dn";
listThisFolder($regexStr);
sub listThisFolder
{
my ($regexStr) = @_;
my $getDir = ("c:\\sh\\");
# I know that the folder exists, but I don't know what the table
# suffix or chunk suffix would be (table-129.tn or table-001.t
+n, etc).
# $ls would hold the contents of the folder which expanded from th
+e regex
my $ls = `dir $getDir$regexStr$suff`;
print "$ls\n";
#return($ls);
}