Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Storing Regex Results

by hotshot (Prior)
on Aug 20, 2002 at 09:21 UTC ( [id://191419]=note: print w/replies, xml ) Need Help??


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)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://191419]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-28 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found