in reply to Re^5: How can I access package variables in a dynamic way
in thread How can I access package variables in a dynamic way
Agreed... although this is really moving into "hack" territory, my code from here could be extended to:
my $amax; for ($amax=1; exists $Person::{"address_$amax"}; $amax++) {} $Person::addresses = sub{\@_}->( map { no strict 'refs'; ${"Person::address_$_"} } 1..$amax-1 );
|
|---|