HTML::Parserを使って、HTML内のタグを無視してテキストだけを抜き出す
--------
--------
use HTML::Parser(); $flgInScript = 0; sub proc_text { my @a =@_; unless ( $flgInScript ){ foreach (@a){ print $_; } } } sub incheck_script { my @a =@_; foreach (@a){ if ( /script/i ){ $flgInScript = 1; } } } sub outcheck_script { if ( $flgInScript ) { $flgInScript = 0; } } if ( $#ARGV <0 ){
new(api_version => 3, text_h => [\&proc_text , "dtext" ], start_h => [\&incheck_script, "tagname"], end_h => [\&outcheck_script,"tagname"]); $p->parse_file($ARGV[0]);