i have an auction script that stores its individual datafiles in a few directories in a larger directory inside of the cgi-bin folder
file > file type folder > auction data > cgi-bin
i am now trying to create a perl script to use as a ssi include file on my non-perl index page, to tell how many items are currently for auction. i have created the following script, yet something is malfunctioning, and i cannot put my finger on the problem... please just take a look and see if you can find the problem.
#!/usr/bin/perl
use vars qw(%config %category);
use strict;
$config{'basepath'} = '/data/web/65682/auctiondata/';
%category = (
snow => 'snow',
skate => 'skate',
surf => 'surf',
misc => 'misc',
);
sub getnumber {
my $key;
foreach $key (sort keys %category) {
umask(000); # UNIX file permission junk
mkdir("$config{'basepath'}$key", 0777) unless (-d "$config{'
+basepath'}$key");
opendir DIR, "$config{'basepath'}$key" or &oops("category di
+rectory $key could not be opened");
my $numfiles = scalar(grep -T, map "$config{'basepath'}$key/
+$_", readdir DIR);
my $totalfiles =+ $numfiles;
closedir DIR;
}
print $totalfiles;
}
lief
Edit Masem 2001-10-02 - Code tags and html-special-char edits
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.