Here's the code

Code: Perl
#!/usr/bin/perl
 
 use CGI;
 
 my $q = new CGI;
 
 $file = $q->param('file') || $ARGV[0];
 
 if(-f $file)
 {
     $txt = qx(cat $file);
 }
 else
 {
     $txt = "File doesn't not exist!";
 }
 
 print $q->header,$txt;