$pa="pp".$i;
@$pa=(what ever is in the array);
if $i=1, this produced an array, called @pp1, which contains "what ever I wanted written to the array"
To cycle through them to check an element for its value I tried using:
for($a=0; $a<=$i; $a++){
$pb="pp".$i;
if(@$pb[1]==1){
... what i want it to do ...
};
unfortunately that doesn’t work, so I tried using:
@{pp{$i}} #being = @pp1
so to print the second element of @pp1 would be
print “${pp{$i{[$i]}}}”; #being equivalent to print “$pp1[1]”;
The idea being to go through a group of arrays @ppX, printing out some of there elements to a table.
Unfortunate none of this seems to work, and throws up all sorts of Ambiguous use errors. I am new to this, and would really appreciate any help.
I´d suggest reading Marcia`s WebmasterWorld Welcome and Guide to the Basics [webmasterworld.com] post which contains a lot of useful information.
If I were you I´d not use symbolic references. A hash approach seems to be much clearer and works whit use [perldoc.com]ing strict [perldoc.com].
my %arrays = (
Aaron1 => [qw(some array elements)],
Aaron2 => [qw(some more array elements)],
Aaron3 => [qw(some other array elements)],
);
#
foreach my $keys (keys [perldoc.com] %arrays) {
print [perldoc.com] join [perldoc.com] ' ', sort [perldoc.com] {$b cmp $a} $arrays{$key};
# or
print [perldoc.com] $arrays{$key}->[0];
}
Andreas