in reply to How to merge the contents of Multiple files stored in the Hash and generate the merged file output along with Header in tabular form

When you read your input files, you intentionally disregard the header lines because they do not match your regex (/\s*(\d+)\s*(\d+\.\d+)/). Because of that, I presume you know ahead of time what the headers should be. Why not just print them out before your print loop?
print "Merged output\n"; print "Distance Fuel_Consumption_Curr Fuel_Consumption_Baseline1\n";
On a side note, Text::Table is handy for printing simple text tables.
  • Comment on Re: How to merge the contents of Multiple files stored in the Hash and generate the merged file output along with Header in tabular form
  • Select or Download Code