sub send_output{ my ($out,$show_line,$show_file_name, $file_name,$line_count, $data) = @_; chomp($data); #strp end of line's to avoid double spacing. my $line; $line = "$file_name," if $show_file_name; $line .= "$line_count," if $show_line; $line .= $data; push @output,$line; }