#does your system support shebang (#!)? $perl = $^X =~ m%/% ? $^X: eval { use Config; return $Config{"installbin"}."/perl"; }; print "Is this perl [$perl]? (n,Y)\n"; $answer = <>; if( $answer !~ /y/i && $answer !~ /^$/ ){ print "Shell thinks perl is here: ", `which perl`; print "Please enter the location of perl now:\n"; $perl = <>; } print "Replacing #!/usr/bin/perl with #!$perl\n";