in reply to Pattern Matching Question (I think)
Reading something between two tags, such as <TAG>my stuff</TAG>:
This matches the text between the two lines, and stores that match (which comes out of the regex as $1), in an array.my @array; while ( my $line = <FILE> ) { if ( $line =~ /\<TAG\>(.*)\<\/TAG\>/ ) { push @array, $1; } }
Putting the text of the next line into a variable after matching something on the previous line..., as in
Which would work to be something like...<TAG>data</TAG> this is data to be stored
In this case, if the tag delimiter is matched, then it reads the next line and sticks that into an array.my @array; while( my $line = <FILE> ) { if ( $line =~ /\<TAG\>data\<\/TAG\>/i ) { my $data_line = <FILE>; push @array, $data_line; } }
If neither case is what you want or helps you get you want to need, you need to be more specific about your format.
|
|---|