Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Help
by valdez (Monsignor) on Feb 14, 2003 at 14:27 UTC
Re: (duplicate) Help
by helgi (Hermit) on Feb 14, 2003 at 16:21 UTC
    Bad subject line.

    Try to find a subject line that actually describes your problem.

    Here's one way:

    #!perl use warnings; use strict; my $dir = '/home/sites/$arg1/users'; opendir DIR, $dir or die "Cannot opendir $dir:$!\n"; my @users = grep { -d "$dir/$_" and not /^\.{1,2}$/} readdir DIR; closedir DIR; # do whatever you want with @users print join "\n",@users;

    --
    Regards,
    Helgi Briem
    helgi AT decode DOT is

Re: (duplicate) Help
by tcf22 (Priest) on Feb 14, 2003 at 16:37 UTC
    You could try using a hash to remove the duplicates or use opendir to open the directory. This is the easiest way that i could think of. Here is how you could remove the dups.
    my %DupKiller; foreach $f(@filelist){ ###Do Your Processing Here $DupKiller{$f} = 1; } my @store = keys(%DupKiller);
    I haven't tested the code, so there might be a typo that I missed, but you can get the general idea.