cranberry13 has asked for the wisdom of the Perl Monks concerning the following question:
What I would like to do is:
1) The first time I see the word I want to footnote it.
2) Any additional instance of the same word should be underlined.
How can I do this in a Regular Expression using the substitution operator ?
The line below will create a footnote for the first instance of the word gregarious:
$line =~ s/gregarious/\\footnote\{gregarious\}/im;
If the word appears again in the file, I would like it to underline it:
$line =~ s/gregarious/\\underline\{gregarious\}/;
Is there a way to combine these two statements and have the first instance of the word formatted differently from the others?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Combining two Reg Expressions with substitution
by Enlil (Parson) on Nov 04, 2003 at 17:59 UTC | |
|
Re: Combining two Reg Expressions with substitution
by Abigail-II (Bishop) on Nov 04, 2003 at 18:02 UTC | |
by Nkuvu (Priest) on Nov 04, 2003 at 18:13 UTC | |
by Abigail-II (Bishop) on Nov 04, 2003 at 18:16 UTC | |
by shenme (Priest) on Nov 04, 2003 at 18:25 UTC |