in reply to Re: Fetching unique info
in thread Fetching unique info

Thanks for all the responses. I still cant fetch the information. I know its coming down to the newline problem because I tried a test by putting it on one line:  <A HREF="JavaScript:AFunction('AA', 'B','0','Project','113')">San Francisco (Manager)
and was able to fetch the different the number that was located where "113" was located:
use LWP::Simple; my $url = 'www.website.com'; my $content = get($url); my ($number) = $content =~ /'(\d{3})'\)">San Francisco (Manager)/; print "$number\n";
BUT I really need to fetch the information where it is split on two lines:
<A HREF="JavaScript:AFunction('AA', 'B','0','Project','113')"> San Francisco (Manager)
I tried both these and still didnt get it to work:
my ($number) = $content =~ /'(\d{3})'\)">\nSan Francisco (Manager)/;
and:
my ($number) = $content =~ /'(\d{3})'\)">San Francisco (Manager)/s;

Replies are listed 'Best First'.
Re: Re: Re: Fetching unique info
by cbro (Pilgrim) on Jun 05, 2003 at 18:19 UTC
    Your use of my ($number) = $content =~ /'(\d{3})'\)">\nSan Francisco (Manager)/; seems almost correct. Why don't you modify it slightly to:
    my ($number) = $content =~ /'(\d{3})'\)">\s+San Franscisco \(Manager\) +/;
    You probably can't guarantee that the newline is a literal "\n", and you didn't escape the parens around the string "Manager".
      Thanks!!!! It now works. I assume "\s+" means match any whitespace character 1 or more times?
        You got it :o)
        There are great tutorials on PM, but if you just want a quick reference...
        Check this out.

        Glad to be of assistance,
        Chris