Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
An example might be computing hash keys for field names:package MYPACKAGE; [...] my ($ab, $cd, $ef, ..., $yz) = map { ... some function of $_ ... } ('ab', 'cd', ..., 'yz');
How can this be done as...my ($field1, ...) = map { __PACKAGE__ . '::' . $_ } ('field1', ...); [...] ... $self->{$field1} ...
...preferably under "use strict;"?foreach (qw(ab cd ef ... yz)) { ??? };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Computed "my" declarations?
by Tanktalus (Canon) on Oct 26, 2005 at 20:42 UTC | |
|
Re: Computed "my" declarations?
by diotalevi (Canon) on Oct 26, 2005 at 22:28 UTC | |
by Tanktalus (Canon) on Oct 26, 2005 at 23:23 UTC | |
by diotalevi (Canon) on Oct 26, 2005 at 23:28 UTC | |
|
Re: Computed "my" declarations?
by BUU (Prior) on Oct 26, 2005 at 21:33 UTC | |
by Anonymous Monk on Oct 26, 2005 at 23:11 UTC | |
by diotalevi (Canon) on Oct 26, 2005 at 23:20 UTC | |
by jdhedden (Deacon) on Oct 27, 2005 at 20:36 UTC |