my @table = ( \$abc, \$def, \$wyz ); $table[$x] = 1; # or my @categories; $categories[$x]++; # or my %categories; $categories{$x} = code2value( $x );