To deliver the same result (i. e. undef) for not found input values, the tr solution has to be a bit more elaborate.
Somewhat along the line of
my $found = (my $pat = substr($0,0,1)) =~ tr/abcd/-=~^/; $pat = $found ? $pat : undef;
In reply to Re^2: Interesting line which I read from Monk's snippets
by pKai
in thread Interesting line which I read from Monk's snippets
by jesuashok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |