# If a user goes from the homepage 'index.pl' to 'search.pl' $ENV{'HTTP_REFERER'} =~ /index.pl/; # From 'search.pl', a user clicks on the link to login via 'login.pl' $ENV{'HTTP_REFERER'} =~ /search.pl/; # If the user logs in SUCCESSFULLY they are redirected # back to 'search.pl' # # However, if the user types an incorrect password, # $ENV{'HTTP_REFERER'} matches # $ENV{'HTTP_REFERER'} =~ /login.pl/ instead of retaining the # intended $ENV{'HTTP_REFERER'} =~ /search.pl/