Mega Code Archive

 
Categories / Perl / Regular Expression
 

Substitute every T with M

$name="Tom"; print "$name\n" if $name =~ s/T/M/g;    # Substitute every T with M print "What is Tom's last name? "; print "You got it!\n" if <STDIN> =~ /Jordan/;