Use the file test operators -d and -f (see Perlfunc.pod): foreach $file (@files) { if ( -d $file ) { print "$file is a directory\n"; } elsif (-f $file) { print "$file is a file\n"; } } Robert Terwilliger wrote: > Dear MacPerl Gods & Goddesses: > > I want to write the following piece of code: > > ############################################## > > $dir = " # Some Mac Directory # "; > chdir("$dir"); > @files = <*>; > > foreach $file (@files) > { > if ( # is it a directory? # ) > { > print "$file is a directory\n"; > } > > else > { > print "$file is a file\n"; > } > } > > ############################################# > > Would you please clue me in on what to put in my "if" statement? > -- > Robert Terwilliger, M.S. > raterwil@ucla.edu > > ==== Want to unsubscribe from this list? > ==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org