P
poncenby
my perl program accepts arguments which will match a directory under
$path. however this argument may not be specified so all directories
shall be processed under $path.
this is the way i'm doing it:
my $idopt = $ARGV[0];
my $path = "/home/user/";
opendir (ROOT, "$path");
if ($idopt) { $idre = qr/$idopt/o; } elsif ( !$idopt) { $idre =
"!/^\.\.?$/"; }
my @dirid = grep { $idre }, readdir (ROOT);
however the dirid array is populated with every directory under $path,
regardless of what I specify in ARGV[0].
can anyone help?
thanks
$path. however this argument may not be specified so all directories
shall be processed under $path.
this is the way i'm doing it:
my $idopt = $ARGV[0];
my $path = "/home/user/";
opendir (ROOT, "$path");
if ($idopt) { $idre = qr/$idopt/o; } elsif ( !$idopt) { $idre =
"!/^\.\.?$/"; }
my @dirid = grep { $idre }, readdir (ROOT);
however the dirid array is populated with every directory under $path,
regardless of what I specify in ARGV[0].
can anyone help?
thanks