Hello,
 I have a script that gets items and corresponding price from a web
site. all goes well until i put the item and price in a hash. When i try
to print key and value from the hash it comes out all weired. Could some
one take a look and see what im doing wrong.

thanks,
-- 
jdavis <[EMAIL PROTECTED]>
p.s. sorry about the wrap...its my mail client :(




#! /usr/bin/perl -w

use LWP::Simple;

$item_string = '\<\!\-\- \#\#\# Display Item\'s Name and make a
hyperlink \#\#\# \-\-\>';
$price_string = 'color="red"';
$URL = 'http://shop.altenergystore.com/items.asp?Cc=SP100%2D';
$content = get($URL);

# put each line of $content into a array
@content = split(/\n/, $content);


@content_reversed = reverse @content;

while(@content_reversed){
        $_ = pop(@content_reversed);
        if(/$item_string/){
                 $the_item = pop(@content_reversed);
                 ($trash,$clean_item) = split(/\<b\>/, $the_item); 
                 print "ITEM = $clean_item\n";
                 
                 do{
                   $_ = pop(@content_reversed);
                 }until(/$price_string/); ## this is the price line
      ($trash,$ruff_price) = split(/\<font color\="red"\>/,$_);
      ($clean_price,$trash) = split(/\<\/font\>\<\/font\>/,$ruff_price);
                 print "PRICE = $clean_price\n";
                 $price_items{$clean_item} = $clean_price;
        }
}
 
while(($k, $v) = each %price_items){
        print "K = $k";
        print "V = $v\n";
}



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to