Substitute first T with an M
#!/usr/bin/perl $name="Tom"; print "Hello Tom\n" if $name =~ /Tom/; print "$name\n" if $name !~ /Tom/; $name =~ s/T/M/; # Substitute first T with an M print "$name.\n";