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


in reply to Using variable contents in new variable name

Perl allows this through symbolic references... but their use results in messy code that is difficult to maintain, and violates strict (which should always be used).

You should use a different type of data structure instead - arrays and hashes are very appropriate here.

my @work_array; $work_array[5] = "plumbing"; my %work_hash; $work_hash{5} = "plumbing";