So, I have to admit... I am a bit more of a "copy-paste" coder... I get the logic, but not always the syntax. :-) I see what you are saying here, and I think it is my answer, but for the life of me I can't get the loop to run. I was getting no data out of this, so I put a debug statement in the "for" loop, and it doesn't appear to be running past the first 2 lines. I can dump $response, and I get valid data..
Dumper($response->{body}->{table})
Here is a snipet of my test code:
print "body-table is:", Dumper($response->{body}->{table}), "\n"; print "=============================================================== +===\n"; my %rec; for (@{ $response->{body}{table} }) { print "Data Record Found - Body Table \n"; my ($key) = grep $_ ne 'content', keys(%{$_->{tr}{td}}); my $val = $_->{tr}{td}{$key}; $rec{$key} = $val; } print "rec is:", Dumper($rec), "\n";
And the result is:
body-table is:$VAR1 = [ { 'tr' => { 'td' => { 'ReturnStatus' => 'Completed', 'content' => "Return Status:\x{a0}" } } }, { 'tr' => [ { 'td' => { 'StateInfo' => '12345', 'content' => "StateInfo:\x{a0}" } }, { 'td' => { 'MultipleSubAccount' => 'N', 'content' => "Multiple Sub Account:\x{a0 +}" } }, { 'td' => { 'Count' => '1', 'content' => "Count:\x{a0}" } }, { 'td' => { 'content' => "Default Account:\x{a0}", 'DefaultAccount' => '1234567' } }, { 'td' => { 'content' => "Caller Phone Number:\x{a0} +", 'CallerPhoneNumber' => '214-555-1212' } }, { 'td' => { 'CallerHouseNumber' => ' 123', 'content' => "Caller House Number:\x{a0} +" } }, { 'td' => { 'ApartmentNum' => {}, 'content' => "Apartment Num:\x{a0}" } }, { 'td' => { 'CallerSalutation' => {}, 'content' => "Caller Salutation:\x{a0}" } }, { 'td' => { 'CallerFirstName' => 'JOHN', 'content' => "Caller First Name:\x{a0}" } }, { 'td' => { 'content' => "Caller Last Name:\x{a0}", 'CallerLastName' => 'SMITH' } }, { 'td' => { 'content' => "Salutation:\x{a0}", 'Salutation' => {} } }, { 'td' => { 'FirstName' => 'JOHN', 'content' => "FirstName:\x{a0}" } }, { 'td' => { 'content' => "MiddleInitial:\x{a0}", 'MiddleInitial' => {} } }, { 'td' => { 'LastName' => 'SMITH', 'content' => "LastName:\x{a0}" } }, { 'td' => { 'Honorific' => {}, 'content' => "Honorific:\x{a0}" } }, { 'td' => { 'content' => "FullName:\x{a0}", 'FullName' => 'JOHN SMITH' } }, { 'td' => { 'OtherName' => {}, 'content' => "OtherName:\x{a0}" } }, { 'td' => { 'OtherNameUsage' => {}, 'content' => "OtherNameUsage:\x{a0}" } }, { 'td' => { 'HouseNumber' => '123', 'content' => "House Number:\x{a0}" } }, { 'td' => { 'content' => "UnitNumber:\x{a0}", 'UnitNumber' => {} } }, { 'td' => { 'content' => "City:\x{a0}", 'City' => 'ANYTOWN' } }, { 'td' => { 'content' => "State:\x{a0}", 'State' => 'OH' } }, { 'td' => { 'Zip' => '12345-1234', 'content' => "Zip:\x{a0}" } }, { 'td' => { 'AddressLine1' => 'JOHN SMITH', 'content' => "AddressLine1:\x{a0}" } }, { 'td' => { 'AddressLine2' => '123 W MAIN ST', 'content' => "AddressLine2:\x{a0}" } }, { 'td' => { 'AddressLine3' => 'ANYTOWN OH 12345-123 +4', 'content' => "AddressLine3:\x{a0}" } }, { 'td' => { 'AddressLine4' => {}, 'content' => "AddressLine4:\x{a0}" } }, { 'td' => { 'AddressLine5' => {}, 'content' => "AddressLine5:\x{a0}" } }, { 'td' => { 'content' => "AddressLine6:\x{a0}", 'AddressLine6' => {} } }, { 'td' => { 'AddressLine7' => {}, 'content' => "AddressLine7:\x{a0}" } }, { 'td' => { 'content' => "AddressLine8:\x{a0}", 'AddressLine8' => {} } }, { 'td' => { 'a' => { 'href' => 'lastpmt.html?stateInfo +=12345', 'content' => 'Last Payment Info' } } }, { 'td' => { 'a' => { 'href' => 'serverrform1.html?stat +eInfo=12345', 'content' => 'Service Error' } } }, { 'td' => { 'a' => { 'href' => 'stopinfoform.html?stat +eInfo=12345', 'content' => 'Stop/Start' } } }, { 'td' => { 'a' => { 'href' => 'renewinfoform.html?sta +teInfo=12345', 'content' => 'Make a Payment' } } }, { 'td' => { 'a' => { 'href' => 'loginform.html', 'content' => 'Change Login' } } } ] } ]; ================================================================== Data Record Found - Body Table Data Record Found - Body Table rec is:$VAR1 = undef;
Any help is GREATLY appreciated!! Thanks!

In reply to Re^2: Parse HTML Code for hidden values by benchtoplabs
in thread Parse HTML Code for hidden values by benchtoplabs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.