if($mystring){ dosumpton(split(/\./, $mystring)); } elsif (not defined $mystring){ dosumpton("nogames"); } else { # Something went wrong and we should be notified about it } #### my @args = split /\./, $mystring; pop @args while (@args and !$args[-1]); dosumpton(@args);