in reply to Storing Regex Results

I suggest you read more about regexp, coz' this is kind of a basic thing:
my @array; while ($line = <DATA>) { if ($line =~ /regexp/) { push(@array, $line); } }
like this you save all the lines that matche your regexp and can work of them. but if you want to save the match result, then:
my @array; while ($line = <DATA>) { if ($line =~ /(regexp)/) { # surrounding the regexp with brackets push(@array, $1); # holds the result of the match from the last +regexp } }


Hotshot

Replies are listed 'Best First'.
Re: Re: Storing Regex Results
by johnirl (Monk) on Aug 20, 2002 at 09:25 UTC
    Yeah I know. Thanks Hotshot. I got it just after I pressed the submit button. This wasn't really ment to be the questioned asked. Made a bit of a mistake. :-( The embarrasment.

    j o h n i r l .

    Sum day soon I'Il lern how 2 spelI (nad tYpe)