Perl Programming | ||
---|---|---|
Regular Expressions | ||
my $string = "Did the fox jump over the dogs?"; $string =~ s/dog/cat/; # substitute "cat" for "dog" $string =~ s(fox)(kangaroo); # substitute "kangaroo" for "fox" print "$string\n"; $string =~ tr/a-z/n-za-m/; # Rot13 print "$string\n"; Did the kangaroo jump over the cats? Dvq gur xnatnebb whzc bire gur pngf? |
||
Previous | http://stuff.mit.edu/iap/perl/ | Next |