T
TheDizzyDevil
Hello everyone,
I am new to Perl and I am just feeling my way around. I was hoping if
someone could help me. I am trying to write a code that will search a
document and return a suffix, specified by the user, and have that
suffix in itallics. Below is the code I have thus far, but it does not
seem to work with out numerous line errors. Can some please help?
$b = 1;
print "What is your input file name:\n";
chomp($infile=<STDIN>);
open IN, $infile or die "No file, no fun!";
print "What is your output file name:\n";
chomp($outfile=<STDIN>);
print "What are you looking for:\n";
chomp($trag=<STDIN>);
open OUT, ">$outfile" or die "No file, no fun!";
while (<IN>) {
if (/$trag [?!'";: -]/) {
$word=$_;
$word=~ s/.+ (.+?$trag)[?!'";: -]/$1/gi;
$word=~ s/.+? ([n] +?$trag)[?!'";: -]/$1/gi;
$word=~ s/(.+?)$trag/$1<i>$trag<\/i>;
print OUT "$outfile $word: $_";
}
$b++;
}
I am new to Perl and I am just feeling my way around. I was hoping if
someone could help me. I am trying to write a code that will search a
document and return a suffix, specified by the user, and have that
suffix in itallics. Below is the code I have thus far, but it does not
seem to work with out numerous line errors. Can some please help?
$b = 1;
print "What is your input file name:\n";
chomp($infile=<STDIN>);
open IN, $infile or die "No file, no fun!";
print "What is your output file name:\n";
chomp($outfile=<STDIN>);
print "What are you looking for:\n";
chomp($trag=<STDIN>);
open OUT, ">$outfile" or die "No file, no fun!";
while (<IN>) {
if (/$trag [?!'";: -]/) {
$word=$_;
$word=~ s/.+ (.+?$trag)[?!'";: -]/$1/gi;
$word=~ s/.+? ([n] +?$trag)[?!'";: -]/$1/gi;
$word=~ s/(.+?)$trag/$1<i>$trag<\/i>;
print OUT "$outfile $word: $_";
}
$b++;
}