#!/Perl -T $what_i_am_about_to_type_at_prompt = 'file to remove.gah'; print "Please enter the file to be removed: \n"; my @file_I_intend_to_remove = ; @file_I_intend_to_remove == 1 or die 'incorrect number of files supplied'; my $file_i_am_about_to_unlink = shift @file_I_intend_to_remove; unless( $file_i_am_about_to_unlink eq $what_i_am_about_to_type_at_prompt ){ printf "%s\n", $file_i_am_about_to_unlink; die 'for the love of ice-cream, don't do an unlink operation just yet'; } # even if it matches you still need to untaint it. $file_i_am_about_to_unlink =~ m/\A(file\sto\sremove\.gah)\Z/ or die 'taint is a pain in the hyperbola, but I enjoy having a working operating system'; $file_i_am_about_to_unlink = $1; # now i can unlink the file as it is the one i am expecting to unlink; printf "unlinking %s\n", $file_i_am_about_to_unlink; # unlink $file_i_am_about_to_unlink; #### my $filename = 'filename.fxt'; my $scrubbed = s/\A(filename\.fxt)\Z/$1/ or die 'need to read up on regex a bit more';