if 1-based answer, then (basically same as the above replies):
my $loc = (index($s, '*')+1) || length($s);
Just note that the strings '12*' and '123' will both yield 3 ...
If you want the latter to return '4' instead, could do:
my $loc = (index($s, '*')+1) || (length($s)+1);
Or, w/zero-base (so '12*'=>2 and '123'=>3), can do:
my $loc = ( (index($s, '*')+1) || (length($s)+1) ) - 1;
maybe not the clearest--but one-line, if that's your definition of "elegant" :)
"better" is perhaps more like (or making a sub):
my $loc = do { my $i = index $s, '*'; $i < 0 ? length($s) : $i };