A few things in addition to what is mentioned
- the obligitory mention of Taint mode. you should add a -T to the /usr/bin/perl -w line. Then you need to check the validity of the input line from the web page. you are trsting the user not to put extra .. and /'s in that could redirect the open command to operate on say ../../../etc/passwd for example.
- You are making assumptions that the filename given will be file.ext and it will break when it gets something like file.ext.gz which is valid on some OSs
- You could save yourself some parseing of the filename by using
FILE::BASENAME
UPDATE:Fixed 'not enough sleep this week' typo picked up by
blakem