in reply to can split() use a regex?
If you don't want to discard the number, you'd need to use capture brackets
my ($one, $two) = split( /(\d+)\s+/, $line, 2);
Probably easier to use m//:
my ($one, $two) = $line =~ m[(\d+)\s+(.*)$];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: can split() use a regex?
by bart (Canon) on Jun 18, 2006 at 11:33 UTC | |
by BrowserUk (Patriarch) on Jun 18, 2006 at 11:40 UTC |