I'd be using:

#!/usr/bin/perl -w

$dir = "/backup";
opendir BACKUPDIR, $dir or die "Cannot open $dir!";
foreach (readdir BACKUPDIR){
  unless ($_ eq "." or $_ eq ".."){
#    print "$_";

    push (@dirs,$_);
  }
foreach (@dirs) {
print "$_\n";
}
}



--------------
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: [EMAIL PROTECTED]





From: "Paul Kraus" <[EMAIL PROTECTED]>
To: "Perl" <[EMAIL PROTECTED]>
Subject: Readdir to array
Date: Fri, 13 Dec 2002 09:56:19 -0500

for some reason the output is different for this script. If I print $_ I
get the correct list. If I print the Array I get roughly the same list 4
times?

#!/usr/bin/perl -w

$dir = "/backup";
opendir BACKUPDIR, $dir or die "Cannot open $dir!";
foreach (readdir BACKUPDIR){
  unless ($_ eq "." or $_ eq ".."){
#    print "$_";

    push (@dirs,$_);
  }
print "$_\n" foreach (@dirs);
}

Paul Kraus
Network Administrator
PEL Supply Company
216.267.5775 Voice
216-267-6176 Fax
www.pelsupply.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

_________________________________________________________________
Ontvang je Hotmail & Messenger berichten op je mobiele telefoon met Hotmail SMS http://www.msn.nl/jumppage/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to