in reply to (jeffa) Re: sometimes use strict isn't enough
in thread sometimes use strict isn't enough

One slight correction...

strict 'subs' and strict 'vars' run their checks at compile time, but the third goblin in that group strict 'refs' enables runtime checks.

(sorry, I was inspired by the dancing skeleton on your homenode ...... ;-) )

Consider the following code, which will toss a strict error during runtime, depending on the flip of a coin:

#!/usr/bin/perl -wT use strict; use vars qw($foo $bar); $foo = 'x'; $bar = int(rand(2)) ? 'foo' : \$foo; print $$bar, "\n"; =OUTPUT (when rand==0) x =OUTPUT (when rand==1) Can't use string ("foo") as a SCALAR ref while "strict refs" in use at ./strictrefs.pl line 9.

-Blake