$ cat ABC
qwe
asd
zxc
$ cat CDE
rty
fgh
vbn
####
#!/usr/bin/env perl
use strict;
use warnings;
use autodie;
open(file_one,"ABC");
while(my $line = )
{ open(file_two,"CDE");
while(my $line2=)
{ print "line : $line line2 : $line2 \n";
}
close(file_two);
}
####
Name "main::file_one" used only once: possible typo at ./pm_example.pl line 8.
line : qwe
line2 : rty
line : qwe
line2 : fgh
line : qwe
line2 : vbn
line : asd
line2 : rty
line : asd
line2 : fgh
line : asd
line2 : vbn
line : zxc
line2 : rty
line : zxc
line2 : fgh
line : zxc
line2 : vbn
####
#!/usr/bin/env perl
use strict;
use warnings;
use autodie;
open my $fh1, '<', 'ABC';
while (defined(my $line1 = <$fh1>)) {
chomp $line1;
open my $fh2, '<', 'CDE';
while (defined(my $line2 = <$fh2>)) {
chomp $line2;
print "line1 : $line1 line2 : $line2\n";
}
}
####
line1 : qwe line2 : rty
line1 : qwe line2 : fgh
line1 : qwe line2 : vbn
line1 : asd line2 : rty
line1 : asd line2 : fgh
line1 : asd line2 : vbn
line1 : zxc line2 : rty
line1 : zxc line2 : fgh
line1 : zxc line2 : vbn