in reply to Re^3: Pattern Matching Q?
in thread Pattern Matching Q?
and it returned a syntax error. I also tried with the other version you gave me here:use strict; use WWW::Mechanize; use HTTP::Cookies; use HTML::TokeParser::Simple; my $mech = WWW::Mechanize->new( stack_depth => 1, agent =>"Mozilla/5.0 + (X11; U; Linux i68+6; en-US; rv:1.7) Gecko/20040918 Firefox/0.9.3 ") +; my $pic = "C:\/LV3.JPG"; $mech->cookie_jar( HTTP::Cookies->new(stack_depth => 1) ); $mech->get("http://tinypic.com"); if($mech->content() =~ /UPLOAD NOW/ ){ print "TinyPic loaded... "; $mech->form_name("upload_form"); $mech->field('the_file' => $pic); $mech->submit(); m{ <strong # match "<strong" .*? # skip to the next ( # (start capturing) http:// # "http://" .*? # skip to the next ) # (stop capturing) & # ampersand }x print $1; }
This version didn't get a syntax error but also didn't output anythinguse strict; use WWW::Mechanize; use HTTP::Cookies; use HTML::TokeParser::Simple; my $mech = WWW::Mechanize->new( stack_depth => 1, agent =>"Mozilla/5.0 + (X11; U; Linux i68+6; en-US; rv:1.7) Gecko/20040918 Firefox/0.9.3 ") +; my $pic = "C:\/LV3.JPG"; $mech->cookie_jar( HTTP::Cookies->new(stack_depth => 1) ); $mech->get("http://tinypic.com"); if($mech->content() =~ /UPLOAD NOW/ ){ print "TinyPic loaded... "; $mech->form_name("upload_form"); $mech->field('the_file' => $pic); $mech->submit(); m{<strong.*?(http://.*?)&}; print $1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Pattern Matching Q?
by jrsimmon (Hermit) on Nov 27, 2007 at 22:25 UTC | |
|
Re^5: Pattern Matching Q?
by madbombX (Hermit) on Nov 27, 2007 at 21:07 UTC |