Hi, try this,
use strict; my $arg = $ARGV[0]; open(IN,"$arg")||die("Can't open the input file for reading"); undef $/; my $str = <IN>; close(IN); $str=~s#\$[^\$]+\$#&LimitReplace($&)#gei; open(OUT,">$arg")||die("Can't open the output file for writing"); print OUT $str; close(OUT); sub LimitReplace{ my ($line)=@_; $line=~s#\\limits##gi; return($line); }
Vivid
In reply to Re: Replacing a substring from a string in a file
by vivid
in thread Replacing a substring from a string in a file
by pop18
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |