#!/usr/bin/perl -w use strict; my ($fh1, $fh2); open $fh1, "file1.dat" or die "I no read file 1.\n"; open $fh2, "file2.dat" or die "I no read file 2.\n"; my $mainfh = $fh1; while (<$mainfh>) { print; $mainfh = ($mainfh == $fh1) ? $fh2 : $fh1; } #### I'm sure this #### pretty that works. #### I'm pretty sure that this works.