Is there a way to extract HTML page title using Perl? I know it can be passed as a hidden variable during form submit and then retrieved in Perl that way but I was wondering if
If you just want to extract the page title you can use a regular expression. I believe that would be something like:
my ($title) = $html =~ m/<title>(.+)<\/title>/si;
where your HTML page is stored in the string $html
. In si
, the s
stands for for single line mode (i.e., the dot also matches a newline) and i
for ignore case.