sub second { my $num_ref = shift; my $sum = 0; my @newarray = ( 6 .. 10 ); # try one of these options # foreach ( @$num_ref, 6 .. 10 ) { foreach ( @$num_ref, @newarray ) { $sum += $_; } return $sum; } #### my $result = second( @num ); sub second { my ( @array ) = @_; # etc #### my $result = second( \@num ); sub second { my ( $aref ) = @_; my @new_array = @$aref; # my $new_ref = [ @$aref ]; # alternative