#! perl -w use strict; use warnings; my $str = "Title: Learning Perl Author: Schwartz, Randal L. ISBN: xxxx"; if ( $str =~ /^Title: (.*)\s+Author: (.*)\s+ISBN: (.*)/ ) { # print "<$1><$2><$3>\n"; my $author = $2; { $author =~ s/\.//g; # Remove full stops (periods) } print "<$1><$author><$3>"; # Line 8 }