in reply to backward split
Seems like reverse split reverse reverse is working a bit too hard.
my $s = 'foo.bar.foobar'; my ($var1, $var2) = $s =~ m[(^.*)\.(.*?$)]; print $var1, $var2; foo.bar foobar
Note: The greedy .* in the first capture and the non-greedy .*? in the second.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: backward split
by Aristotle (Chancellor) on Jun 01, 2003 at 12:04 UTC |