Occurences of planet were changed to world : translation « Regular Expression « Perl






Occurences of planet were changed to world

    

use strict;
use warnings;

my $string = "This planet is our planet.";

print "$string\n";
my $matches = $string =~ s/planet/world/g;
print "$matches occurences of planet were changed to world.\n";
print "The new string is: $string\n";

   
    
    
    
  








Related examples in the same category

1.Options for the translation operator.
2.Swap the first two words in a string
3.Introducing the translation operator