in reply to Script won't retrieve data from database

Did you try:
chomp(my @webpages = <WEBPAGESFORALL>);
Also, shouldn't $webpages['$count1'] be $webpages[$count].
-imran