Mega Code Archive

 
Categories / Perl / Regular Expression
 

The e Modifier Evaluating an Expression

Format: s/search pattern/replacement string/e; # The e and g modifiers while(<DATA>){       s/6/6 * 7.3/eg;       # Substitute 6 with product of 6 * 7.3       print; } __DATA__     5     4     6 6     1     666     66