あなたの質問は、問題を実証するための最小限のコード サンプルを提供していません。
問題の原因はコードに隠されています。
use strict;
use warnings;
use feature 'say';
use Data::Dumper;
my @array;
@array = map { int(rand(500)) } 0..100;
merge_dat(@array);
sub merge_dat {
my(@args) = @_;
my $count = 0;
say $count++ . " $_" for @args;
}
大きな配列を引数として渡すのはあまり意味がありません。コピーを作成するために多くのリソースが必要になり、CPU サイクルが浪費されます。
このような状況では、配列参照またはハッシュ参照を使用することをお勧めします。
use strict;
use warnings;
use feature 'say';
use Data::Dumper;
my $data;
$data->{new_fname} = '/some/file/location1';
$data->{existing_fname} = '/some/file/location2';
$data->{out_fname} = '/some/file/location3';
$data->{start} = '1003';
$data->{end} = '30013';
$data->{time_adj} = '0:14:18.8';
$data->{orig_fname} = '/some/file/location0';
$data->{time_period} = '0:35';
$data->{indent} = 8;
$data->{verbose} = 0;
$data->{dup_discard} = 1;
merge_dat($data);
sub merge_dat {
my $param = shift;
say Dumper($param);
say '=' x 45;
say 'Out filename: ' . $param->{out_fname};
}
出力
$VAR1 = {
'dup_discard' => 1,
'out_fname' => '/some/file/location3',
'existing_fname' => '/some/file/location2',
'new_fname' => '/some/file/location1',
'time_adj' => '0:14:18.8',
'time_period' => '0:35',
'indent' => 8,
'orig_fname' => '/some/file/location0',
'end' => '30013',
'start' => '1003',
'verbose' => 0
};
=============================================
Out filename: /some/file/location3