in reply to list dir contents, w/o some stuff

You're very close on this one...
One thing you will see a lot around here - use strict and the -w flag.
One of the things that using the warning flag and the strict pragma would have caught is that you have two different names for the array that you use to contain the files you don't want to list - @nowshow and @noshow. Using strict and the -w flag can save a lot of heartache and headaches in finding problems in your code. Also, if this is a CGI script, you want to look into the -T flag. Take a look at perlsec for more information.

The other problem is with the unless statement. $f eq @noshow won't work. It won't tell you if $f is equal to a value in @noshow. What you need to do is use the grep function. This pulls out information from a list based on the criteria that you set. In the code below, it searches for $f in the list of filenames not to display. If it finds it, it won't print it out.

Finally, another recommendation - use CGI or die. The module CGI.pm provides many, many built in functions for creating CGI scripts. It's invaluable for creating CGI programs.

#!/usr/bin/perl -w print "Content-type: text/html\n\n"; opendir(DIR,"./") || die print "Couldn't open directory"; my @files = readdir(DIR); closedir(DIR); my $filename = __FILE__; my @noshow = (".", "..", $filename); foreach $f (@files) { unless (grep /$f/, @noshow) # look for $f in @noshow { print "$f <br>\n"; } }

Rich36
There's more than one way to screw it up...