#!/usr/bin/perl -w use strict; # you're safer with this use CGI; my $query = new CGI; print "Content-type: text/html\n\n"; my $name = $query->param('name'); my $file; { # let's be safe here with filehandles, too local *FILE; open (FILE, $name) || error("Can't find $name: $!"); my $first_line = ; chomp ($file = ); # takshaka gets bonus points for actually testing it close FILE; } if ($file eq $query->param('pass')){ # more logically phrased print qq[ ]; } else { error("Sorry, that was the wrong pass/name, please try again."); } sub error { my $text = shift; print qq[$text]; exit; }