in reply to HTML image tag stripping
#!/usr/bin/perl #htmltest2.plx # Program will read in an html file, remove the img tag and print out # no need for file variable yet: open (INFILE, "<".$htmlFile) or die(" +Can't read source file!\n"); use warnings; use diagnostics; use strict; my @htmlLines; open INFILE, "t.htm" or die ("Sod! Can't open this file.\n"); @htmlLines = <INFILE>; @htmlLines = scrapTag(@htmlLines); # calls method to remove image tags sub scrapTag # removes image tags from HTML document { my @htmlLines = @_; for (@htmlLines) { $_ =~ s/<IMG\s+([^>]+)>//ig # replaces each instance of image tag + with nothing! } return @htmlLines; } for (@htmlLines) { print; } print "\n\n"; sleep 2; print "Success?!\n"
|
|---|