in reply to Joining Arrays?
You could do it with nested maps:
open my $url_fh, '<', 'urls.txt' or die "Can't read 'urls.txt': $!"; chomp( my @urls = <$url_fh> ); close $url_fh or die "close() failed: $!"; open my $code_fh, '<', 'data.txt' or die "Can't read 'data.txt': $!"; chomp( my @codes = <$code_fh> ); close $code_fh or die "close() failed: $!"; my @joined = map { my $url = $_; map { $url . $_ } @codes } @urls;
Note that this actually creates an array for the results, while a foreach solution won't.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Joining Arrays?
by graff (Chancellor) on Dec 21, 2008 at 03:52 UTC | |
by kyle (Abbot) on Dec 21, 2008 at 04:45 UTC | |
by pobocks (Chaplain) on Dec 21, 2008 at 06:07 UTC | |
by pKai (Priest) on Dec 21, 2008 at 17:26 UTC | |
by gone2015 (Deacon) on Dec 21, 2008 at 13:17 UTC | |
by Lawliet (Curate) on Dec 21, 2008 at 06:48 UTC | |
|
Re^2: Joining Arrays? (perl6)
by eric256 (Parson) on Dec 22, 2008 at 03:32 UTC | |
by TimToady (Parson) on Dec 23, 2008 at 02:25 UTC | |
by nagalenoj (Friar) on Dec 22, 2008 at 10:00 UTC | |
by eric256 (Parson) on Dec 22, 2008 at 16:11 UTC |