in reply to Can't Reference a Sub by Variable when using Strict
Just to make the discussion complete, actually you can turn this on and off. However, I am not saying that you should turn the checking off, on the contrary, you should ALWAYS turn it on.
use warnings; my $ref = "foo"; no strict("refs"); #bad idea &$ref; #works, as strict is turned off for refs use strict("refs"); #good idea &$ref; #don't work any more sub foo { print "foo called once\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can't Reference a Sub by Variable when using Strict
by davido (Cardinal) on Oct 04, 2004 at 03:01 UTC | |
by pg (Canon) on Oct 04, 2004 at 03:10 UTC | |
by tachyon (Chancellor) on Oct 04, 2004 at 03:41 UTC | |
by broquaint (Abbot) on Oct 04, 2004 at 08:49 UTC | |
by tachyon (Chancellor) on Oct 04, 2004 at 12:24 UTC | |
|