in reply to Meta tag
Hope this helps. Liamuse 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;
|
|---|