次の行があるため、質問の前提に誤りがあります。
$monitored_paths = {'svn/test-repo' => '/src/cpp', '/src/test', '/src/test2'}
次のいずれかと同等です。
$monitored_paths = {'svn/test-repo' => '/src/cpp', '/src/test' => '/src/test2'}
$monitored_paths = {'svn/test-repo', '/src/cpp', '/src/test', '/src/test2'}
あなたが本当に欲しいのは:
$monitored_paths = {'svn/test-repo' => ['/src/cpp', '/src/test', '/src/test2']}
ここで、[] は配列参照を示します。次のような配列参照を作成します。
my $arrayref = [1, 2, 3]; # called an "anonymous array reference"
またはこのように:
my @array = (1, 2, 3);
my $arrayref = \@array;
次のようなものが必要です。
$monitored_paths = { '/svn/test-repo' => 'http://....list.txt' }
foreach my $key (keys %$monitored_paths) {
next if ref $monitored_paths{$key} eq 'ARRAY'; # skip if done already
my @paths = get_paths_from_url($key);
$monitored_paths->{$key} = \@paths; # replace URL with arrayref of paths
}
get_paths_from_url を URL フェッチおよび解析関数に置き換えます (LWP などを使用します...それは実際には質問の一部ではなかったので、その方法は既に知っていると思います)。関数 get_paths_from_url を記述して、最初に配列ではなく配列参照を返す場合は、ステップを保存して$monitored_paths->{$key} = get_paths_from_url($key)
代わりに記述できます。