I'm not sure exactly how you want to implement your search, but perhaps this will help provide a hint as to at least one possibility. I'm sure someone will point out a better way to do it, but I found that this works:
use strict; my ($htm_file); opendir(CUR_DIR, ".") || die "Can't open current directory: $!\n"; foreach $htm_file (grep -f && -e && /\.htm$/i, readdir(CUR_DIR)) { open(HTM_FILE, "$htm_file") or die "Can't open $htm_file: $!\n"; while (<HTM_FILE>){ # while there are lines in the file if(/<meta/i){ # if the line is a meta tag, have a look at it /content=\"(.+?)\">/i; # if it contains 'content' grab it print "$1\n"; # here's where you do something with it } } close HTM_FILE or die "Can't close $htm_file: $!\n"; } closedir CUR_DIR;
Hope this helps. Liam

In reply to Re: Meta tag by sawtooth
in thread Meta tag by No-Lifer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.