##
open OUTFILE, ">/var/www/data/$ARGV[0]" or die "cannot....";
##
##
my $filename = $ARGV[0];
# Use whatever regex suits your needs. this is just an example.
if ($filename =~ /^([\w]+\.[\w]+)$/) {
$filename = $1;
} else {
# handle the error here
}