in reply to Re: Re: Combining two Reg Expressions with substitution
in thread Combining two Reg Expressions with substitution

#!/usr/bin/perl use strict; use warnings; $_ = <<'--'; gregarious foo gregarious foo foo gregarious foo gregarious gregarious foo gregarious foo -- s/(gregarious)/\\underline{$1}/g && s/\\underline\{(gregarious)\}/\\footnote{$1}/; print; __END__ \footnote{gregarious} foo \underline{gregarious} foo foo \underline{gregarious} foo \underline{gregarious} \underline{gregarious} foo \underline{gregarious} foo

Abigail

Replies are listed 'Best First'.
Re: Re: Combining two Reg Expressions with substitution
by shenme (Priest) on Nov 04, 2003 at 18:25 UTC
    So when the entire file has been slurped into the one variable you can operate on it this way. But if the file is being read a line at a time (implied somewhat by cranberry13 variable naming), then Enlil's method is preferable.