use strict; use CGI qw(:standard); my $action = trim(param('ACTION')); my $user = trim(param('name')); my $pass = trim(param('password')); if ($action eq 'DELETE') { if ($user eq 'fishbreath' and $pass eq 'foobazz') { unlink 'path/to/csv.file'; } else { # permission denied! } } else { # do other stuff } sub trim { my $raw = shift; $raw =~ s/^\s*//g; # remove leading space $raw =~ s/\s*$//g; # remove trailing space return $raw; }