Can't use string ("") as a subroutine ref while "strict refs" #### my $var1; my $var2; my $regex=qr/^Device(\s)+Configuration/; tie %functions, 'Tie::RegexpHash'; %functions = ( ($regex => \&get_device); my $result = $functions{$var1}->($var2);