G'day joshywashy,
As already pointed out (either directly or via link), in order for us to help you, you need to provide:
-
The input data in a form that shows us exactly what it looks like.
-
The actual code you're running so we can also run it.
-
The actual output your code is producing (including any error or warning messages).
-
The expected output, i.e. what you really wanted.
In the code you posted, you have a definite problem with "while<$process>". I suspect you also have a problem with "elsif(/something else/)".
Is this closer to what you were trying to achieve:
#!/usr/bin/env perl
use strict;
use warnings;
while (<DATA>) {
if (/in mmgsdi_evt_cb/) {
print 'MATCH: ', $_;
}
else {
print 'OTHER: ', $_;
}
}
__DATA__
0x0 in mmgsdi_evt_cb
mmgsdi X
mmgsdi Y
0xd in mmgsdi_evt_cb
0x1a in mmgsdi_evt_cb
0xe in mmgsdi_evt_cb
0xf in mmgsdi_evt_cb
mmgsdi Z
0x13 in mmgsdi_evt_cb
mmgsdi Z
mmgsdi Z
Output:
MATCH: 0x0 in mmgsdi_evt_cb
OTHER: mmgsdi X
OTHER: mmgsdi Y
MATCH: 0xd in mmgsdi_evt_cb
MATCH: 0x1a in mmgsdi_evt_cb
MATCH: 0xe in mmgsdi_evt_cb
MATCH: 0xf in mmgsdi_evt_cb
OTHER: mmgsdi Z
MATCH: 0x13 in mmgsdi_evt_cb
OTHER: mmgsdi Z
OTHER: mmgsdi Z
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.