View Single Post
  #2 (permalink)  
Old 12-09-03, 07:01 PM
Skeleton Man Skeleton Man is offline
Community Liaison
 
Join Date: Jun 2003
Location: Australia
Posts: 406
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Arowana

Consider the following substitution:

s/([A-Z][a-z]+) ([A-Z][a-z]+)/$2 $1/;

Suppose $_ eq "Tom Hanks" before the above substitution is applied. What is stored in $_ afterwards?
Try it for yourself and see, put the following into a script and run it:

Code:
#!/usr/bin/perl

$_ = "Tom Hanks";
s/([A-Z][a-z]+) ([A-Z][a-z]+)/$2 $1/;

print "$_\n";
Reply With Quote