[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-AnyPerl] Syntax Question



I am working with an example script from a book on cgi scripting and have run
across some unfamiliar syntax that is not explained and Perl doesn't seem to
like. I think that all of the relevant stuff is included in:

my $dir = $_[0];
    my $st = $_[1];
    my (@dirs, @files, @results, $filename, $newdir, $list);
    opendir(DIR, $dir);
    @dirs = grep {!(/^\./) && -d "$dir/$_"} readdir(DIR);
    rewinddir(DIR);
    @files = grep {!(/^\./) && /html$/ && -T "$dir/$_"} readdir(DIR);
    closedir(DIR);
    
    for ($list(0..$#dirs)   {
        if (!($dirs[$list] = [td]/temp/ || $dirs[$list] = [td]/images/))    {
            $newdir = $dir."/".$dirs[$list];
            &scan_files($newdir, $st);
            
What we are supposed to be doing is making a directory list to be followed by a
file scan. There may still be some other problems with the above, but the part I
do not understand at all is the [td] as used in the if() statement. Perl
complains that this is a bareword that may conflict with future reserved words,
but I am more concerned that I just don't grasp what this is in any case.

I do know that there were some problems relating to a lack of quoting and other
stuff in some of the other program listings, but I assumed those were proofing
errors while this looks like High Martian to me. Any thoughts?

Thanks.

Richard Gordon
Gordon Consulting & Design
maccgi@bellsouth.net



==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org