Mega Code Archive

 
Categories / Perl / Regular Expression
 

Substitute tom with Mary

while(<DATA>){    print if s/tom/Mary/i;    # Substitute tom with Mary } __DATA__     tom     Mary     Jack     James     Jon     Kate