$_ =~ s//sgi;/sgi; # $_ is now 'sgi;' if($_ =~ /sgi;/){ $_ =~ tr/gs/aj; # 'jai;' } tr/i;/ph/; # 'japh' print $_; # Voila!