in reply to combine multiple files into one (line by line)

try this:

#!/usr/bin/perl -w # These files have this format: # filename::line number (e.g., 1.txt::1) my @files = ( "1.txt", "2.txt", "3.txt", ); my $total_strings = 9; my $cur_pos = 0; my $next_pos = 0; open(MIXED, ">mixed.txt") || die "(x) Failed: mixed.txt - $!\n"; for (my $cur_string=1; $cur_string <= $total_strings; $cur_string++) + { print "\nCurrent String: $cur_string of $total_strings\n"; foreach my $file (@files) { print " Opening File: $file\n"; print " Current Position is: $cur_pos\n"; open(FILE, $file) || die "(x) Failed: $file - $!\n"; @file = <FILE>; $string = $file[$cur_pos]; close(FILE); print " Read string: $string"; #print MIXED $string; print " Next Position is: $next_pos\n\n"; } $next_pos = $cur_pos + 1; $cur_pos = $next_pos; } close(MIXED);
</code> my $name = 'Ben Kittrell'; $name=~s/^(.+)\s(.).+$/\L$1$2/g; my $nick = 'tha' . $name . 'sta';