why not just read the files and add the text to an array. key:Filename, value count. then increment count.
> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, December 17, 2002 12:22 PM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: problems with scalar(@array) > > > > 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] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]