Hello - me again....
Take this example code:
This should work and add one to element [1] in the array @array.
My question is, how can I write my subs more legibly by being able to do something like
and get the same result?
Is it something to do with typeglobs?
Some of my subroutines working on passed references are getting pretty ugly with @{ and $$ all over the place!
TIA
Take this example code:
Code:
my @array = (1, 2, 3);
pass_array( \@array );
sub pass_array ($) {
my $aref = shift;
$$aref[1]++
}
This should work and add one to element [1] in the array @array.
My question is, how can I write my subs more legibly by being able to do something like
Code:
$sub_array[1]++
Is it something to do with typeglobs?
Some of my subroutines working on passed references are getting pretty ugly with @{ and $$ all over the place!
TIA