in reply to Pulling lines from a file into an array?
You just open each file handle in turn and keep pushing the lines on to the array:
my @lines; open(IN1, '<', 'file1') or die $!; while(my $line = <IN1>) { chomp $line; push @lines, $line; } close(IN2); open(IN2, '<', 'file2') or die $!; while(my $line = <IN2>) { chomp $line; push @lines, $line; } close(IN2); my $size = scalar(@lines); # Get the size of the array
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|