This is the simple data file parser I wrote for my school. The Format is (yes this is rigid and not very nice) Title Page Name Output file name BGColor FGColor Number of links that need to be created Data I have many, many links to parse, so this was my quick fix. I want to write this as a true parsed language, but for now this is all I need --LiteStar (Stefan Edwards)
#!/usr/bin/perl use strict; my ($count, $title, $outname, $bgcolor, $fgcolor,$line, $pgname); my ($link_name, $link_ref); die "Need Data File!\n" unless $ARGV[0]; open(FDIN,"<$ARGV[0]") or die "Cannot open file ".$ARGV[0]."\n"; chomp($title = <FDIN>); print "title => $title\n"; chomp($pgname = <FDIN>); print "Page name => $pgname\n"; chomp($outname = <FDIN>); print "output file => $outname\n"; chomp($bgcolor = <FDIN>); print "bgcolor => $bgcolor\n"; chomp($fgcolor = <FDIN>); print "fgcolor => $fgcolor\n"; chomp($count = <FDIN>); print "number of links => $count\n"; open(FDOUT,">$outname") or die "Could not create file ".$outname."\n"; print FDOUT <<EOD; <html><head><title>$title</title></head> <body BGCOLOR=$bgcolor TEXT=$fgcolor> <h3>$pgname</h3> <p> EOD $count++; for(;$count > 0; $count--) { chomp($line = <FDIN>); if($line =~ /__END__/) { print "All Finished, Cleaning up."; last; } ($link_name,$link_ref) = split(/,/,$line); print "Link Name: ".$link_name."\n"; print "Link Reference: ".$link_ref."\n"; print FDOUT "<u><a href=$link_ref>$link_name</a></u>\n"; } close(FDIN); print FDOUT << "OFF"; </p></body></html> OFF close(FDOUT);