I have data that looks similar to this -
Quote:
John Smith (Address)
123 Main St
Unit 1
Los Angeles, CA 90201
Jane Smith (Address)
321 Elm St
Denver, CO 80201
|
So I need everything between each name, but I am not guaranteed that each time I match a name that I will have the same amount of lines, so I do a range pattern search line this to get all lines, no matter if there is 5 or 10 or 15. I simply do a loop that goes through the whole array until I hit the match, and this is my search pattern.
Code:
if ($LINE =~ /^\s+$SELECTED_NAME/ ... $LINE =~ /\(Address\)/) {
push @ADDRESS_INFO, $LINE;
}
This works perfectly... until I hit the end and it doesn't get its final pattern match because it's at the end and there is no next entry with a (Address) line. So as a 'hack', I ended up inserting a final scalar at the end of the array that just says (Address) so it knows it's at the end. Ideally though, I'd like to do an "or" statement that says search for Address || return true if I hit the end of the array. How would I match on "End Of Array" essentially?
Devon