I know I can create an array and a reference to an array as follows:
my @arr = ();
my $rarr = \@arr;
I can then iterate over the array reference as follows:
foreach my $i (@{$rarr}){
}
Is there a way to copy or convert the array ref to a normal array so I can return it from a function? (Ideally without using that foreach loop and a push).