Hello Monks,
I have written the following code which successfully grabs some text representing a date, which is embedded inside a form as a subtitle
my $reportdate; my $tp = HTML::TokeParser->new($sourcefile) or die "Unable to open meg +.out: $!"; #The report date is embedded inside a form as a subtitle. #Therefore, find the form called calendarForm and then look #for a <td> tag which contains the date while (my $tag = $tp->get_tag("form")) { my ($tagname, $attr, $attrseq, $rawtxt) = @{ $tag }; if ($rawtxt =~ /calendarForm/) { while ( my $tag = $tp->get_tag("td")) { my ($tagname, $attr, $attrseq, $rawtxt) = @{ $tag }; if ($rawtxt =~ /subTitle/) { $reportdate = $tp->get_trimmed_text("/td"); print "report date =" . $reportdate . "\n"; last; } } } }
Then I switched each occurance of my ($tagname, $attr, $attrseq, $rawtxt) = @{ $tag }; with my $rawtxt = pop @{ $tag };, expecting it to work similarly, but did see the date printed out. However, the script did not fail, and executed code furhter below.
Can you explain why the pop doesn't work?
In reply to HTML::TokeParser question by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |