On Mon, Jul 22, 2013 at 4:55 AM, Omega -1911 <1911...@gmail.com> wrote:

> Can anyone shed some light and point me in the right direction?


Specifically, your REs are failing because there is a space in the data
after the close quote for the class attribute that your REs don't have.
This a good example of why parsing html w/ REs is a fraught with fragility
process.  There are better REs you could create, esp. if this is a one time
processs
if ( /store-(\w+)[^>]+>([^>]+)>/ ) {
   $business_info{$1} = $2;        # e.g. address => "Business Address"
}

but it's always going to be brittle

my %business_info;
while (<DATA>) {
  if ( /lnk-store-item/ and %business_info  ) {
    # print/clean out data
    print "$_ => $business_info{$_} \n" foreach sort keys %business_info;
    %business_info = ();
  }
  if ( /store-(\w+)[^>]+>([^>]+)>/ ) {
    $business_info{$1} = $2;        # e.g. address => "Business Address"
  }

}  # while DATA




-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

Reply via email to