Consider following script:
use strict;
use Data::Dumper;
my @arr=('1A','2A');
my $arr_ref=['1','2'];
sub routine1
{
my @arr=@_;
print Dumper(\@arr);
}
routine1(@arr,'one_A');
sub routine2
{
my $arr_ref=[@_];
print Dumper($arr_ref);
}
routine2($arr_ref,'one');
routine1 is using @arr and routine2 is using $arr_ref.
routine1 prints the following:
$VAR1 = [
'1A',
'2A',
'one_A'
];
routine2 prints following:
$VAR1 = [
[
'1',
'2'
],
'one'
];
I want to continue using @_ and arr_ref in routine2 but want to come up with below output:
$VAR1 = [
'1',
'2'
'one'
];
Can someone suggest the way out?