Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > parsing html qu...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 10610 of 11989
Post > Topic >>

parsing html question

by isaac_2004@[EMAIL PROTECTED] (Isaac2004) Feb 5, 2008 at 10:36 AM

hello, i am trying to parse an html do***ent for links for output, my
idea is to grab the URL from a form and send the URL to another file
that does the actual parse process. i am aware that HTML:Parser has a
built in for this, but i want to learn regex better. my plan after i
get the file is to put the new varaible into a loop construct and use
a regex cpmparitor to put a match into an array. the only problem is
that i dont know how to setup such a loop and grab the whole "piece"
of what i need. i have included some code that i have made. i would
appreciate any help given. thank you


#!/usr/local/bin/perl

use CGI ':standard';
use LWP::Simple;
##Declare globals -----------------------------------



$url = "http://www.yahoo.com";

$linkstring = "http://";
$imagestring = ".gif";
  my $content = get $url;
  die "Couldn't get $url" unless defined $content;
#---------------------------------------------------


print header, start_html({-title =>'Your Results'});
if($content =~ m/$linkstring/i) {
    $var = m/$linkstring/i;
print "$var\n";
  } else {
    print "No\n";
  }
if($content =~ m/$imagestring/i) {
    print "Yes\n";
  } else {
    print "No\n";
  }
print end_html;
 




 2 Posts in Topic:
parsing html question
isaac_2004@[EMAIL PROTECT  2008-02-05 10:36:32 
Re: parsing html question
tom@[EMAIL PROTECTED] (T  2008-02-05 15:40:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 22:59:35 CDT 2008.