in reply to regex on a line

There're a quiet a few bugs in this, and I think you'd really benefit from putting use strict at the top of your programs.

Anyway, you're missing a curly bracket, and you've spelt "view" wrongly in your print statement, so you'd never get a proper result.

Also, the string you're trying to match: "(view: pa_Iden etc etc)" has got spaces in it, so you'll never succeed in your match if you use the non-whitespace character, \w. You could substitute that for "." which matches anything, although I have heard monks say that ".*" is bad practice (I'm still quite a novice tho', so I don't know why they say this!).

Finally, when you assign to $view, you mean $2, not $1. You could do with taking out some of those brackets, which are confusing you with backreferences.

Here's a version which works:

while(<check>) { if (m/^(?:Update Status:)\s*(\w+)/) { $target = $1; } if ($target eq "open") { if (m/^(?:Update Status:)\s*(\w+)\s*(.*)$/) { $view = $2; } print "$target\n"; print "$view\n"; close(check); } }
However, here's a slightly more concise version which only uses one regex:
while(<check>) { if (m/^(?:Update Status:)\s*(\w+)\s*(.*)$/) { if ($1 eq "open") { $view = $2; print "$view\n"; close(check); } } }
Note that in each of these, as soon as an "Update: open" line is found, the file is closed. I don't know if that's what you want, but if not, you'll have to move that close(check); line.

HTH
Dennis