On Thu, Jul 05, 2001 at 02:43:01PM -0500, SAWMaster wrote:
> Hello group!
>
> I'm trying to list all files in a directory EXCEPT the current and the parent
>directories.
>
> I thought I had the right code, but I don't.
>
> while($i < ($#filelist))
> {
> if ((@filelist[$i] ne '.') || (@filelist[$i] ne '..'))
> {
> print @filelist[$i];
> print "<BR>\n";
> $i++;
> }
> }
You need to check your boolean logic. Try && instead of ||
And use $filelist[$i]
or (untested)
for (@filelist)
{
if ($_ ne '.' && $_ ne '..')
{
print $_;
print "<BR>\n";
}
}
or
print map { "$_<BR>\n" } grep { ! /^\.\.?$/ } @filelist;
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net