in reply to Use of uninitialized value in pattern match (m//)
The regex /^\s*$/ matches by default against the $_ scalar, which is nowhere initialized in the code you show. Perhaps $str =~ /^\*$/ was what you meant?