Mega Code Archive

 
Categories / Perl / Regular Expression
 

Metasymbols and subpatterns

while(<DATA>){     s/(\w+)\s(\w+)/$2, $1/; # Reverse first and last names     print; } __DATA__     First Last