CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [shawnhcorey] Parsing values and names in HTML Dropdown: Edit Log



twistedphrame
Novice

Mar 2, 2010, 4:37 PM


Views: 3650
Re: [shawnhcorey] Parsing values and names in HTML Dropdown

Thanks for the suggestion. I've figured out how to get the string for each element in the Term dropdown but I'm not sure how to get the value of each, when I try the ->content_list I just get memory locations I'm not sure how to use.


Code
my $tree = HTML::TreeBuilder->new; 
$tree->parse($content);
$head = $tree->look_down('_tag', 'td',
sub { $_[0]->as_text =~ m{Term}
}) ;
$term1 = $head->as_text;
$term1 =~ s/(Term)(.*)/$2/;


this will give me a string that looks like:

Code
10/SP - Spring 201010/SU - All Summer 201010/SA - Summer A 201010/SB - Summer B 201010/SC - Summer C 201010/SD - Summer D 201010/SE - Summer E 201010/FA - Fall 201011/SP - Spring 2011

I can write something to extract the names of each easy enough but I want to hash these names to the actual values and I'm not sure as how to do this.


(This post was edited by twistedphrame on Mar 2, 2010, 5:35 PM)


Edit Log:
Post edited by twistedphrame (Novice) on Mar 2, 2010, 5:35 PM
Post edited by twistedphrame (Novice) on Mar 2, 2010, 5:35 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives