やり方は色々あるんですが、HTML::TagParserを使う方法を書きます。 表示がずれるので、空白2文字を全角空白にしてます。 use strict; use warnings; use HTML::TagParser; my $page = << 'EOT'; <html> <head> <title>The Title</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <hr /> <form id="form1" method="get" action="print_env1.cgi"> <input type="text" name="username" value="Anonymous" /><br /> <input type="