SPUG: RE: Simple program - gone wrong

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

Off the top I find this line suspect:
for($num = 0; $num <= 100; $num += 1) # note there is no opening curly brace
I don't know how perl treats this; very early on I learned to use braces
even if I have only one statement in the conditional and have never quest
the convention, so it just leaped out at me.

-----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:


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");}}

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/>
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/f8fca8a6/attachment.htm

More information about the spug-list mailing list