in reply to Creating a column of frequency for the unique entries of another column

I think you want to print headings only outside your foreach loop:
print OUTPUT "\n", $headings; foreach ( $line =~ m/$sequence/i ) { if ( $line =~ m/$sequence(.{11})(.{11})$sequence/ ) { print OUTPUT "\n", $1, "\n", $2; } $local_count++; }

Aside: perltidy is nice.

  • Comment on Re: Creating a column of frequency for the unique entries of another column
  • Download Code