#!/usr/bin/perl use strict; use warnings; use 5.010; my $file = '1151282.dat'; open my $fh, '<', $file or die $!; my @headers; while ( <$fh> ) { chomp; if ( $. == 1 ) { @headers = split ','; next; } my @strings = split ','; for ( 0 .. @headers - 1 ) { say "$headers[ $_ ] $strings[ $_ ]"; } say ''; } __END__