SPUG: RE: Simple program - gone wrong

EXT-Corcoran, David david.corcoran at Boeing.COM
Mon Jul 8 12:30:51 CDT 2002


It also looks like you are opening RDIR for reading; again I always use
">file" or "<file" even the input form does not require the redirection
symbol.
 
open(RDIR,"./admin/data/rdir.txt");
 
also note that the print statement is written wrong:
 
 
print(RDIR, "$num | $name\n");}}

should be:
 
print RDIR ("$num | $name\n");}}
 

 
 
 
 
 

 
 -----Original Message-----
From: Sweethomes [mailto:sweetsue at sweethomes.com]
Sent: Monday, July 08, 2002 9:58 AM
To: Seattle Perl User's Group
Subject: SPUG: RE: Simple program - gone wrong


Not sure if this went through - resending:


Scratching my head over this one.  All I want is to read the upper
directory, list out the files names and then print the results with
numbering to a file.  Here is what I have:

 

#!/usr/bin/perl
open(RDIR,"./admin/data/rdir.txt");
opendir(DIR, "../");
@files = readdir(DIR);
for($num = 0; $num <= 100; $num += 1)
foreach $name (@files) {
if(-d $name){}elsif($name eq "." || $name eq ".."){}else{
print(RDIR, "$num | $name\n");}}
close(RDIR);
close(DIR);
exit;

I've got the worst headcold in my personal history and I'm thinking that my
brain just is not functioning.  If anyone can clear this up for me, I'd
appreciate it!

Happy 4th of July to all!


www.web-dev-design.com <http://www.web-dev-design.com/>
<http://www.enso-company.com/> 
------------------------------------
Susanne Bullo, Developer     Web Dev Design
16646 SE 10th Street                Bellevue, WA 98008
Telephone: 425.562.6040         Facsimile: 425.671.0571

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/spug-list/attachments/20020708/43ce133f/attachment.htm


More information about the spug-list mailing list