in reply to Re: Mojo::DOM find tag after another tag
in thread Mojo::DOM find tag after another tag
looks too complicated and not nice (but working).my $tmpi = 0; $fimg = $dom ->find('img, h1') ->map( sub { if( $_->tag eq 'h1' ) { $tmpi++; } if( $tmpi > 0 && defined $_->attr->{'src'} ) { $_->attr->{'src'} } # without semicolumn!!!! } ); for( my $ii = 0; $ii <= $#$fimg; $ii++ ) { if( length( $fimg->[$ii] ) > 0 ) { print $fimg->[$ii]; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Mojo::DOM find tag after another tag
by haukex (Archbishop) on May 29, 2016 at 19:54 UTC | |
by luxs (Beadle) on May 29, 2016 at 20:29 UTC |