the corresponding code isCan't use string ("") as a subroutine ref while "strict refs"
if I use a string as the key the code works, how can I expand the regex correctly for the function to use it?my $var1; my $var2; my $regex=qr/^Device(\s)+Configuration/; tie %functions, 'Tie::RegexpHash'; %functions = ( ($regex => \&get_device); my $result = $functions{$var1}->($var2);
In reply to Using a regex as a hash key by jivanm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |