sweepy838 has asked for the wisdom of the Perl Monks concerning the following question:
the output is myname.whatever but i just want "myname" can anyone explain why its jumping to the last dot?sub name($) { ($name)= $_[0] =~ m/\@(.*)\./; return $name; } print name('aaa@myname.whatever.com');
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex extracting text
by GrandFather (Saint) on Apr 29, 2012 at 04:17 UTC | |
by JavaFan (Canon) on Apr 29, 2012 at 10:34 UTC | |
by sweepy838 (Acolyte) on Apr 29, 2012 at 12:48 UTC |