> my final goal is to loop through each filename and count how many times > each filename appears, example: archive/summer.html 2 > arts.html 2 > arttherapy.html 3. > > > for right now, I'm just trying to loop through the array @url. > Next step would be to compare whats in $line with what's in $url[$i] > and if it's different reset the counter... > > my understanding of scalar(@url) is that it should give me the total > count for the number of filenames. What I expected $i to do, was to > keep increasting to 732 (as this is the number of lines in the data.txt > file) > > still confused, > Pam >
$file = "arts.html"; open (INPUT, $file); @line = <INPUT>; $count = grep (/$file/, @line); or: foreach $file (qw(arts.html foo.html bar.html)) { open(INPUT, $file); @lines = <INPUT>; $count += grep (/$file/, @line); } But I have to warn you, it's not actually tested... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]