in reply to Directory Listing to array

See readdir, it returns a list.

my @standir = grep {! /^\./} readdir(DIR);
But perhaps glob is more what you want. It will ignore dotfiles.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Directory Listing to array
by tachyon (Chancellor) on Apr 10, 2002 at 09:25 UTC

    Actually while (my $file = readdir DIR) { print "$file\n" } will happily iterate over readdir. Try it. Also your grep solution will skip files like:

    . .. .bashrc .any_other_unix_style_hidden_file/dir

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print