sub print_logcon { my ($which,$f1,$f2,$f3,$f4) = @_; if ($which eq 'general') { print "$f1"; print LOG_FILE "$f1" or kill_and_clean_up( "Error printing to $LOG_FILE: $!" ); } elsif ($which eq 'comparison') { my $f1_multi = $f1; format COMP_TOP = File version comparison Type File name Previous New ------------------------------------------------------------------------------ . format COMP = @<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< $f4, $f1, $f2, $f3 ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $f1 . select(LOG_FILE); $^ = 'COMP_TOP'; $~ = 'COMP'; write LOG_FILE or kill_and_clean_up( "Error printing to $LOG_FILE: $!" ); $f1 = $f1_multi; # format destroys the variable, so reassign it select(STDOUT); $^ = 'COMP_TOP'; $~ = 'COMP'; write STDOUT; } elsif ($which eq 'file_info') { my $f2_multi = $f2; format FILE_INFO_TOP = File Compilation Information Type File name Version ------------------------------------------------------------------------------ . format FILE_INFO = @<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< $f1, $f2, $f3 ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $f2 . select(LOG_FILE); $^ = 'FILE_INFO_TOP'; $~ = 'FILE_INFO'; write LOG_FILE or kill_and_clean_up( "Error printing to $LOG_FILE: $!" ); $f2 = $f2_multi; # format destroys the variable, so reassign it select(STDOUT); $^ = 'FILE_INFO_TOP'; $~ = 'FILE_INFO'; write STDOUT; } }