The regex /^\s*$/ matches by default against the $_ scalar, which is nowhere initialized in the code you show.
Perhaps $str =~ /^\*$/ was what you meant?
In reply to Re: Use of uninitialized value in pattern match (m//)
by AnomalousMonk
in thread Use of uninitialized value in pattern match (m//)
by troyhughes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |