in reply to Modifying file input before displaying output

You have to
  1. Print a http header (at least a Content-Type header)
  2. open the file (check for errors!)
  3. Read from the file (with the $variable = <$filehandle>; syntax) and print its content
  4. close the file

Update: Op updated the post, so I'll do that as well ;) Step 3 involves a small computation then. And probably chomp to remove the newline from the string before treating it as a number.