On Jul 5, SAWMaster said:
>while($i < ($#filelist))
>{
> if ((@filelist[$i] ne '.') || (@filelist[$i] ne '..'))
> {
> print @filelist[$i];
> print "<BR>\n";
> $i++;
> }
>}
The chief problem is your logic.
if ($f ne '.' || $f ne '..') {
print $f;
}
When '.' gets to this, it fails the ($f ne '.') test. So it tries the ($f
ne '..') test, and succeeds, so it is printed. Similarly, when '..' gets
to the ($f ne '.') test, it succeeds, so it is printed.
Change the logic to:
if ($f ne '.' && $f ne '..') {
# ...
}
and it will work.
You might just want to use a for-loop, by the way:
for (@files) {
print "$_<br>\n" if $_ ne '.' and $_ ne '..';
}
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **