use strict; use File::Basename; my ($name,$path,$suffix) = fileparse($ARGV[0], '\.html?'); unless (($suffix) && (-e $ARGV[0])) { complain() } rename ($ARGV[0], $path . $name . ".asp") && print "File converted to ASP!" or complain(); sub complain { print "Error: Check and try again"; exit; }