in reply to can split() use a regex?
Unfortunately, in the case of running the regexp through split, this will cause match variables to be rendered undefined at the point where split returns.
There might be some nasty trick to force split to abort and leave match variables intact, but I can hardly recommend such an approach.
The OPs implied alternative for regexping without split when coded correctly, would look something like:
$line =~ /^(\d{4})(.*)$/ or die "unexpected content at line $.\n"; my ( $one, $two ) = ( $1, $2 );
-M
Free your mind
|
|---|