#!/usr/bin/perl if($ARGV[0]) { open(RAW,$ARGV[0]) || die("Can't open input file!\n$!\n"); open(COOK,">$ARGV[0].html") || die("Can't open output file!\n$!\n"); } else { open(RAW,"<&STDIN"); open(COOK,">&STDOUT"); } print COOK "\n". "\n"; while() { chomp(); s/^\s*$//g; # remove newline, and whitespace-only lines if($_ eq "") { print COOK "\n"; next; } s/\t/ /g; s/^ +/ /g; # remove tabs, extra spaces; my(@Temp) = split(" "); # Note, two spaces if($#Temp==2) { $Code = ""; } elsif($#Temp==3) { my($RawCode) = shift(@Temp); my($Color); if($RawCode =~ /^G/) { $RawCode =~ s/G//g; if($RawCode eq "") { $RawCode = " " } $Code = ""; } elsif($RawCode =~ /^II/) { $Code = ""; } elsif($RawCode =~ /^I/) { $Code = ""; } else { $Code = ""; } } else { warn "More than four fields on a line!"; } print COOK "\n$Code". "\n\n"; } print COOK "
CodeSongArtistAlbum
 
 $RawCode". "$RawCode$RawCode$RawCode
$Temp[0]$Temp[1]$Temp[2]
\n"; close(RAW); close(COOK);