In addition to the excellent comments by patgas, I'd like to add a few things.
- Near the start of your script, you use CGI qw(:all); While it is very good that you are using the CGI module, and I definately don't want to discourage that, I don't see why you want to use the :all tag. The :all tag will export all bajillion functions from the CGI module into your namespace, which will definately slow your script down. For most general uses, the qw(:standard) tag will be enough for all of your needs, and in this specific case, qw(header param); will be be sufficient since you are only using those 2 functions from the CGI module.
-
You use Fcntl qw(:flock); but never use the flock() function. Do you realize that flock needs to be manually called in the code, and that file locking isn't automatic? See the flock documentation for more details and examples.
-
I'm not sure where flock would do you any good in this case, as files only open for reading don't need to be flocked. Flock is there so that multiple scripts that have the same file open for writing do not overwrite each other's output.
-
Variables are allowed in Perl (and even have been known to increase readability!); you don't have to do EVERYTHING with $_ :)
Using LWP::UserAgent in this instance is fine, its just that the monk probably thought that LWP::Simple might be easier for you to use. Additionaly, to parse out meta tags, you might want to take a look at HTML::TokeParser, as it was designed to parse out specific tags. Luckily for you, HTML::TokeParser is part of the LWP distribution so you already have it. At any rate, if the examples in the docs aren't enough, try using the Super Search to dig up more examples.