http://www.perlmonks.org?node_id=258355


in reply to how can i use one handle for multifple files

Yep, you can keep a filehandle in a scalar at any time:

open my $fh1,'<', $file1 or die ...; open my $fh2,'<', $file2 or die ...; my $fh = $fh1; print $fh ...; if( some_condition ){ $fh = $fh2; } print $fh .... close $fh1; close $fh2;
--
http://fruiture.de