Remove the slashes from your regex:
my $name = qr{(\w+)};
Since you end the regular expression in qr{} , everything inside the braces is interpreted as a regular expression. Therefore, if you want to expand your search, this will be:
print "ok\n" if $line ~~ /\/(\w+)\
Since your line does not start or end with a slash (or has any substrings), the match does not work, and you do not type ok .
Canspice
source share