use utf8; # use warnings; # use strict; sub manual_desc { $ncontent = `head -n10 index.dumped.html`; $ncontent =~ s/\r|\n//g; chomp($ncontent); print "$ncontent SDSAD"; } use HTML::TokeParser; use Data::Dumper; my $p = HTML::TokeParser->new(shift); my $tag; while ( $tag = $p->get_tag("meta") ) { if ( defined( $tag->[1]{'name'} )) { if($tag->[1]{'name'} eq "description") { my $content = $tag->[1]{'content'}; $content =~ s/\r|\n//g; chomp($content); if ($content ne "") { print $content; } else { &manual_desc(); } #print $tag->[1]{'content'}; } # print $tag->[1]{'name'} . ": " . $tag->[1]{'content'} . "\n"; }; } print "\n";