Eh, what? You want to put all of this code at the end of the script? Sure, why not? If you're worried about a lack of initialisation for this static variable until it's far too late, you can wrap the initialisation in a BEGIN block:
print mytest(), "\n";
{
my $static;
BEGIN {
$static = "Persistant";
}
sub mytest {
return $static;
}
}