On Thu, Mar 20, 2008 at 9:16 AM, Süleyman Gülsüner <[EMAIL PROTECTED]> wrote: > Hi, > > You can use opendir, readdir and may play with grep as below; > > opendir $dir, '/tmp' or > @list = grep ! /^\.\.?$/, readdir($dir); > grep to remove '.' and '..' snip
This isn't anymore efficient than saying my @list = grep { ! /^\.\.?$/ } </tmp/*>, </tmp/.*>; If you are going to use readdir, use it in a loop: my @list; while (readdir $dir) { push @list, $_ unless /^\.\.?$/; } -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/