in reply to using regex to capture a string and an array

That /g is making the whole regex try to match again. I don't think it's helping you here. Try the non-greedy anything match instead and get specific about your delimiter. You *said* what you wanted. It looks like this:
my ($site, $digits) = $String =~ m{ ^(.{3}) # the site code .+? # noise, as little as possible though (\d+) # the digits (keepers) \. # the delimiter }x;

-Paul

Replies are listed 'Best First'.
Re^2: using regex to capture a string and an array
by wol (Hermit) on Nov 02, 2009 at 16:26 UTC
    Once you've got the digits as a string, you can turn that into an array thus:
    my @RS = split "", $digits;
    (This is included in the suggestion below from BioLion, but it's a bit buried in the code, so I thought I'd post it by itself. No votes required.)

    --
    use JAPH;
    print JAPH::asString();