文件操作 - hbody
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/doc/libhtml-parser-perl/examples/hbody
编辑文件内容
#!/usr/bin/perl use strict; use warnings; use HTML::Parser (); my $doc = <<'EOT'; <!-- This is not where <BODY> starts --> <title>foo</title> <script language="Perl" description="Print out <BODY>"> open(BODY, "body.txt"); while (<BODY>) { print; } </script> <!-- The next thing will be <BODY> the body --> <Body> Howdy! </body> EOT my $body_offset; HTML::Parser->new( start_h => [ sub { return unless shift eq "body"; $body_offset = shift; shift->eof; # tell the parser to stop }, "tagname,offset,self" ] )->parse($doc); die "No <body> found" unless defined $body_offset; my $head = substr($doc, 0, $body_offset, ""); print $doc;
修改文件时间
将文件时间修改为当前时间的前一年
删除文件