Mega Code Archive

 
Categories / Perl / Regular Expression
 

Substitution Example

use strict; use warnings; my $string = "Hello to the world"; print "The original string is: \"$string\"\n"; $string =~ s/world/planet/; print "s/world/planet/ changes string: $string \n\n";