数组问题请教

数组问题请教

数组问题请教
file1 >
a
b
c

file 2 >
66

如何产生 file3
a 66
b 66
c 66

#!/usr/bin/perl
use strict;
use warnings;

my $a1 = $ARGV[0];
my $a2 = $ARGV[1];
my $a3 = $ARGV[2];


open (f1, "$a1") or die "Can not open the $a1 file:$!\n";
open (f2, "$a2") or die "Can not open the $a2 file:$! \n";
open (f3, ">$a3") or die " Can't write the $a3 file:$!\n";

@array = split (/\n/,`cat $ARGV[0]`);
@array1= split (/\n/, `cat $ARGV[1]`);
foreach $k1(@array) {
foreach $k2 (@arry1){
print f3 "$k1,$k2" }
next;}

我写不出来了。 谢谢大家.


psh:~$ sub process_file .
psh:~$ sub process_file {
> my ($file) = $_;
> my @list = qx{ cat $file };
> chomp foreach (@list);
> return "{" . join(',', @list) . "}";
> }
psh:~$ print join "\n", glob(join "", map(process_file, ('file1', 'file2')))
a66
b66
c66

楼上的真强,不知道glob可.
楼上的真强,不知道glob可以这样用