my $line = ''; foreach $key (@FieldNames) { $line .= "\t" . ( defined( $FORM{$key} ) and $FORM{$key} =~ /\S/ ) ? $FORM{$key} : "BLANK": } print LOGFILE "$line\n";