G'day Steve,
Welcome to the Monastery.
Without any code, it's not possible to advise how to modify it such that you get the results you want.
In brief, you can access arrays using the original name (@array_original_name):
$ perl -E 'my @name = qw{a b c}; say for @name' a b c
You can create an arrayref and access that with the @$arrayref notation:
$ perl -E 'my $name_ref = [qw{a b c}]; say for @$name_ref' a b c
You can take a reference to an existing array and access that as in my last example:
$ perl -E 'my @name = qw{a b c}; my $name_ref = \@name; say for @$name +_ref' a b c
I suspect you're doing something wrong, given the "$var='name'" you mention; however, as already stated, without seeing your code, I can't help you with that.
Take a look at "perlreftut - Perl references short introduction". At the end of that document, you'll find links to more in-depth information.
Before posting again, plesae see the guidelines in "How do I post a question effectively?"; also consider using an "SSCCE". You'll get much better answers if you provide all the relevant details.
— Ken
In reply to Re: Array naming difference @name @{'name'}
by kcott
in thread Array naming difference @name @{'name'}
by stevemadden
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |