It looks like the HTML parser took your tags away (You should make sure to use <CODE> tags to keep things nice.); as well as the fact that it's hard to interpret exactly what you are trying to do. I see either two things that you are attempting:
Reading something between two tags, such as
<TAG>my stuff</TAG>:
my @array;
while ( my $line = <FILE> ) {
if ( $line =~ /\<TAG\>(.*)\<\/TAG\>/ ) {
push @array, $1;
}
}
This matches the text between the two lines, and stores that match (which comes out of the regex as $1), in an array.
Putting the text of the next line into a variable after matching something on the previous line..., as in
<TAG>data</TAG>
this is data to be stored
Which would work to be something like...
my @array;
while( my $line = <FILE> ) {
if ( $line =~ /\<TAG\>data\<\/TAG\>/i ) {
my $data_line = <FILE>;
push @array, $data_line;
}
}
In this case, if the tag delimiter is matched, then it reads the next line and sticks that into an array.
If neither case is what you want or helps you get you want to need, you need to be more specific about your format.
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
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.