Skip to main content.
home | support | download

Back to List Archive

Re: Ignore Question

From: Gentile, Jeff <GentileJ(at)not-real.netscout.com>
Date: Fri Feb 21 2003 - 19:22:45 GMT
Bill,
	You had pointed me in the "prog" direction to ignore my "header" section in my technotes, which is the first 8 lines... I looked that the "DirTree.pl" and the example in SWISH-RUN... and when I index the files by the normal method, I get 41917 words, however, when I use the prog method, I get 161 words. Even accounting for the words in my header, there can't be more then 100 unique words there...

Any ideas what I'm doing wrong? 

Here is my "print" sub...

/Jeff

------------------------
sub tech_print {

    my $filename = shift;
    my $doctype;
    my $docsize = '0';
    
    if ($filename =~ /\.html?$/) {
        $doctype = 'HTML*';
    } else {
        $doctype = 'TXT*';
    }
        
    open (FH, "<$filename") || die "Cannot open $filename for read $!\n";
    flock (FH, LOCK_SH) || die "Cannot get shared lock for $filename $!\n";
    my $mtime = stat($filename)->mtime;
    my @line=<FH>;
    close (FH) || die "Cannot close $filename $!\n";
    
    for (1..8) {
        shift @line;
    }
    
    foreach (@line) {
        $docsize .= $_;
    }
    
    my $size = length $docsize;

print <<EOF;
Path-Name: $filename
Content-Length: $size
Last-Mtime: $mtime
Document-Type: $doctype

EOF
;
    print @line;
}
Received on Fri Feb 21 19:23:28 2003