http://qs321.pair.com?node_id=1174372


in reply to Re^2: How relevant is the order of 'use's ?
in thread How relevant is the order of 'use's ?

Actually I think you can do even simpler/easier to read:

use Exporter; use base qw/Exporter/; our %constants; BEGIN { push @ISA, 'EXPORTER'; %constants = (SUCCESS => 1); @EXPORT = map "&$_", keys %constants; } use constant \%constants;
Since I guess your goal is to export all the constants in Demo2 without having to provide the list of names twice. And with the & appended to each name, there's no risk of overwriting $SUCCESS;