in reply to backward split
update: This returns the last two items in a split, not the item split on the last pattern, as the OP had intended.#!/usr/bin/perl -w use strict; my $string = "foo.bar.foobar"; my ($val1,$val2) = (split /\./,$string)[-2,-1]; print "$val1,$val2\n";
-enlil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: backward split
by Anonymous Monk on Jun 01, 2003 at 00:51 UTC | |
by Enlil (Parson) on Jun 01, 2003 at 01:00 UTC | |
by sauoq (Abbot) on Jun 01, 2003 at 01:37 UTC |