Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks, I have a doubt regarding Perl Regex.
my $total_names = "Matthew,Thomas,Peter,Randy,George,Federick";
my $last_name = $1 if ($total_names =~ /,(.*)/i);
print "$last_name;
I want to print the last name "Federick" only. but now its printing from "Thomas to Federick". Pls can you suggest a way.(using regex). Thanks in advance Monks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex Doubt.
by Anonymous Monk on Oct 16, 2012 at 03:03 UTC | |
by Anonymous Monk on Oct 16, 2012 at 03:12 UTC | |
by Anonymous Monk on Oct 16, 2012 at 03:18 UTC | |
by Anonymous Monk on Oct 16, 2012 at 03:21 UTC | |
by Athanasius (Archbishop) on Oct 16, 2012 at 03:40 UTC | |
by Anonymous Monk on Oct 16, 2012 at 03:42 UTC |