in reply to Selecting Correct Array
The problems are that symbolic references only work with global variables (because they have to be in the symbol table), and they're prone to errors. If you typed @{"Menu_$foo"}, you could be wondering for a long time why you get an empty array back.#!/usr/bin/perl -w use strict; no strict qw(refs); our @menu_info=qw(1 2 3); our @menu_sell=qw(3 4 5); foreach my $foo ("info","sell") { print "Values in \@menu_$foo: "; print join ",",@{"menu_$foo"}; print "\n"; }
That's why "use strict;" disallows them.
You're much better off using the hard reference approach, which is what the answers above this one recommend.
--
Mike
|
|---|