Can't use string ("test1") as a subroutine ref while "strict refs" in use. with strict enabled. Would someone mind explaining to me why this is? #use strict; #!/usr/bin/perl -w use strict; my %lists = ( 'test1' => "stuff", 'test2' => "things" ); for my $i (keys %lists) { &$i(); } sub test1 { print "New message for test1\n"; } sub test2 { print "New message for test2\n"; }
In reply to Can't Reference a Sub by Variable when using Strict by Dru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |