Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating an list/array with glob & then test

Status
Not open for further replies.

millimeter

Programmer
Mar 30, 2002
12
US
I am trying to create a directory list array so that I can then check the list for a specfic directory name. I have not been able to find an example, nor do it succesfully. This is what I am supposing will work?;

while(glob("*/")) {
$_(@dirlist);
}

foreach $list(@dirlist)
{
if($list eq "images/") {
&goHere;
}

Suggestions Please - Thanks in advance!

Your Friend,
millimeter

 
while(glob("*/")) {
&goHere if($_ eq "images/");
}
or you can use -d
while(glob "*"){
&goHere if(-d and $_ eq 'images');
}
 
Thanks tl66 but That method exits on finding the case... I need to check the list/array for several items at different times without globing every time. Or print the list such as;

foreach $list(@dirlist)
{
prnt "$list";
}
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top