in reply to strict refs
I can fix this by not using use strict; but I'd rather not.This sounds to me that you're using "use strict" because someone convinced you it was a good idea, but you don't really know what's for.
Many people have the impression that "use strict" prevents you from writing bad code. Or preventing you to use certain "bad" constructs. That's not true. "use strict" disallows certain interpretations of code; it prevents perl to interpret your code in a certain way when that way could easily be a mistake. In your case, the use of &{"DBI::$_"} as a symbolic reference intended - so you can tell Perl that you intend it this way by disabling 'use strict "refs"' for the block:
There's nothing wrong with that.foreach (@{ $DBI::EXPORT_TAGS{sql_types} }) { no strict "refs"; printf "%s=%d\n", $_, &{"DBI::$_"}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: strict refs
by SuicideJunkie (Vicar) on Oct 28, 2008 at 14:01 UTC | |
by LesleyB (Friar) on Oct 28, 2008 at 15:36 UTC | |
|
Re^2: strict refs
by LesleyB (Friar) on Oct 28, 2008 at 15:31 UTC | |
by Narveson (Chaplain) on Oct 28, 2008 at 17:19 UTC |