in reply to Re^3: Replacement and conversion of flat file text documents
in thread Replacement and conversion of flat file text documents
Yes that is what I have to do!
I have this,
This should do everything but not the paragraph elements! Any guidance would be great! I have left out the "<" brackets so that it will display properly#!/usr/bin/perl use English; use diagnostics; print "html body\n"; while ($line = <>) { if ($line =~ m/Emma [[:punct:]]/) { print "h2 $line h2\n"; } if ($line =~ m/CHAPTER (.*)/) { print "h2 $line h2\n"; } if ($line =~ m/Jane Austen/) { print "h2 $line h2\n"; } if ($line =~ m/VOLUME (.*)/) { print "h2 $line h2\n"; } if ( not ( $line =~ m/Jane Austen/) ) { if ( not ( $line =~ m/Emma [[:punct:]]/)) { if ( not ( $line =~ m/CHAPTER (.*)/)) { if ( not ( $line =~ m/VOLUME (.*)/)) { $line =~ s|\b_|<i>|g; $line =~ s|_\b|</i>|g; print $line; } } } } } print "body html\n";
Edit by tye: Add CODE tags
|
|---|