in reply to Finding location
The first part is easy, use index. The length requirement means an additional test:
my $pos = index $str, '*'; $pos = length $str if $pos < 0; [download]