First and foremost: do not undef $/ unless this is a script that...
If none of those apply to the script in question, go ahead. Of course, otherwise you probably want to use as small of a scope as possible and localize $/. Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> }; by jeffa might help out with a preferred way to do it.
In regards to your regex question, you're merely checking whether or not $Hap contains INT8U followed somewhere later by a right parenthesis. You then happily print $Hap. Of course, I'm curious about a few things. You want to capture the void what(void *kiss,INT8U\nmiss) but it's somewhat difficult to know how to design our regex unless we know a few things: Will the lines always come in pairs? Will the first line always start with void or is there a list of keywords that can be there or can it be just anything? If INT8U isn't on the same lines as the opening parenthesis, should we still match the entire line? Is it legal to have our opening left parenthesis at the beginning of a new line? Can parentheses be somehow embedded within the parentheses? Will we always be looking for INT8U or does it depend upon a variable? Should we stop capturing at the closing right parenthesis or should we capture that entire line?
Those are the questions you need to recognize and ask yourself prior to attempting to write your regular expression. Once you can do that, recognizing text patterns and deciding upon a regex to describe those patterns becomes much easier, even natural. In short, check out perldoc perlretut for a basic introduction to regular expressions as well as the difference between matching and substituting as well as when and when not to capture. Whenever you think you have a good grip on the basics, read perldoc perlre for everything you'd ever want to know about regular expressions.
While I somewhat doubt I've helped you with your problem, I hope this at least helps you to become more proficient with regular expressions.
In reply to Re: Trouble matching more than one line
by !1
in thread Trouble matching more than one line
by Levan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |