in reply to Adding items to arrays: best approach?

You can use "push" function, to push whole list to the end of array. See this example:

# perl -e 'use Data::Dumper; my @a = qw(1 2 3); push @a, map { $_ * 2 +} qw(4 5 6); print Dumper(\@a); ' $VAR1 = [ '1', '2', '3', 8, 10, 12 ];

Now commpare your problem:

# perl -e ' my @array1 = qw(one two three); my @array2 = qw(four seven nine); my $prefix = "C:/Temp/somedir"; my @fulllist = map { "$prefix/$_" } @array1; push @fulllist, map { "$prefix/$_" } @array2; use Data::Dumper; print Dumper(\@fulllist); ' $VAR1 = [ 'C:/Temp/somedir/one', 'C:/Temp/somedir/two', 'C:/Temp/somedir/three', 'C:/Temp/somedir/four', 'C:/Temp/somedir/seven', 'C:/Temp/somedir/nine' ];

Replies are listed 'Best First'.
Re^2: Adding items to arrays: best approach?
by Anonymous Monk on May 28, 2020 at 14:13 UTC

    Or, getting back to the OP's original request (but using interpolation),

    push @inputfiles, "$inputPathPrefix/test4.xml", "$inputPathPrefix/test5.xml", "$inputPathPrefix/test6.xml", "$inputPathPrefix/test7.xml", ;

    This is my personal favorite way to append to an array.

    I do not normally build file names this way, preferring something like the old File::Path. Though, as others have pointed out, there are sexier way to do things these days.