http://www.perlmonks.org?node_id=255430


in reply to Re: Not strict
in thread A Perl aptitude test

That is what you call doing it once and only once?
my $namespace = \%GMPN::Database::Table::; my %inject = ( pre_insert => sub { ... }, pre_update => sub { ... }, ); for my $subpkg (qw[org user group foo bar]) { my ($method, $code); $namespace->{"$subpkg::"}->{$method} = $code while ($method, $code) = each %inject; }

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re^2: Not strict (once and only once)
by diotalevi (Canon) on May 04, 2003 at 05:40 UTC

    Ok, so it was at least better. And thinking back, I initially wrote each glob access many lines apart which didn't lend itself to that expression.