Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Capturing parentheses out of scope

by Anonyrnous Monk (Hermit)
on Jan 20, 2011 at 21:04 UTC ( [id://883404]=note: print w/replies, xml ) Need Help??


in reply to Capturing parentheses out of scope

You could assign them (i.e. $1..$N) to an array declared in the outer scope — or in the if-scope: if (my @f = /...

But what would you expect them to hold if the regex doesn't match? Or is it only the second test (and ( !/numsnp=[1-4]\s+/ )) that is expected to fail in these cases?

Replies are listed 'Best First'.
Re^2: Capturing parentheses out of scope
by iangibson (Scribe) on Jan 20, 2011 at 21:10 UTC

    To clarify: every line will match the first regex, so only the second test is important in distinguishing the two groups of lines (as you suggested). I'd like the rejected lines to go into a file in the same format as the successful lines so I can visually check that nothing was rejected that shouldn't have been.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-26 03:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found