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::$_"}; }
In reply to Re: strict refs
by JavaFan
in thread strict refs
by LesleyB
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |