use Carp; #set command line arguments my ($infi, $outfi) = @ARGV; my ($type) = $outfi =~ /\.([^.]+)$/; open(my $fh, "<", $infi) || croak "can't open $infi: $!"; open(STDOUT, ">", $outfi) || croak "can't open $outfi: $!"; my $lastVend = ""; while (<$fh>) { my ($vend, $mod, $set) = split('\t', $_); if ($type eq "html") { if ($vend eq $lastVend) { printf(", %s", $mod); } else { if ($lastVend eq "") { printf("
%s
\n\t\n
\n
%s
\n\t\n
\n
"); } close $fh;