Hello all - I am working on a small address book conversion where I need to
convert a text file in where I dumped the addresses and post them to my
database/website using the Mechanize module. My problem is I am trying to
parse the data using the following code that is not working. Can anyone
shed some light and point me in the right direction? Thank you for any
ideas!



 while (<DATA>) {

if ( $_ =~ /<a class="lnk-store-item" href="(.*) target="_top">(.*)<\/a>/i)
{  $store = "$2"; $http = "$1"; }
   elsif ( $_ =~ /<div class="div-store-address">(.*)/i) {  $address = $1; }
   elsif ( $_ =~ /<div class="div-store-city-state-zip">(.*)/i) {  $city =
$1; }
   elsif ( $_ =~ /<div class="div-store-phone">Phone (.*)/i) {  $phone =
$1; }
   else {   }

__DATA__
</div>
<div class="stores-cont">
<div class="store-item">
<a href="http://myurl.com"; class="lnk-store-item" target="_top" >Business
Name</a>
<div class="div-store-address" >Business Address</div>
<div class="div-store-city-state-zip" >City, State Zip</div>
<div class="div-store-phone" >Phone 111-111-1111</div>
</div>
<div class="store-item">
<a href="http://myurl.com"; class="lnk-store-item" target="_top" >Business
Name</a>
<div class="div-store-address" >Business Address</div>
<div class="div-store-city-state-zip" >City, State Zip</div>
<div class="div-store-phone" >Phone 111-111-1111</div>
</div>
<div class="store-item">
<a href="http://myurl.com"; class="lnk-store-item" target="_top" >Business
Name</a>
<div class="div-store-address" >Business Address</div>
<div class="div-store-city-state-zip" >City, State Zip</div>
<div class="div-store-phone" >Phone 111-111-1111</div>
</div>
<div class="store-item">
<a href="http://myurl.com"; class="lnk-store-item" target="_top" >Business
Name</a>
<div class="div-store-address" >Business Address</div>
<div class="div-store-city-state-zip" >City, State Zip</div>
<div class="div-store-phone" >Phone 111-111-1111</div>
</div>
<div class="store-item">
<a href="http://myurl.com"; class="lnk-store-item" target="_top" >Business
Name</a>
<div class="div-store-address" >Business Address</div>
<div class="div-store-city-state-zip" >City, State Zip</div>
<div class="div-store-phone" >Phone 111-111-1111</div>
</div>

Reply via email to