Tricky has asked for the wisdom of the Perl Monks concerning the following question:
Where am I going wrong, folks? Cheers, Richard#!/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, "E:\\Documents and Settings\\Richard Lamb\\My Documents\\ +HTMLworkspace\\HTML practice\\My First Page!\\firsttest\.html" or die + ("Sod! Can't open this file.\n"); @htmlLines = <INFILE>; scrapTag(); # calls method to remove image tags sub scrapTag # removes image tags from HTML document { while($htmlLines[$i] =~ m/<IMG\s+([^>]+)>/ig) # finds each instance +of image tag in the input file { s/<IMG\s+([^>]+)>/ig//ig # replaces each instance of image tag wit +h nothing! } } for my $i (0..@htmlLines-1) { print $htmlLines[$i]; } print "\n\n"; sleep 2; print "Success?!\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Global symbol probs...
by Abigail-II (Bishop) on Aug 07, 2003 at 13:31 UTC | |
by Anonymous Monk on Aug 07, 2003 at 15:47 UTC | |
|
Re: Global symbol probs...
by mpeppler (Vicar) on Aug 07, 2003 at 13:50 UTC | |
by Anonymous Monk on Aug 07, 2003 at 16:08 UTC | |
|
Re: HTML tag extraction probs...
by benn (Vicar) on Aug 07, 2003 at 13:56 UTC | |
|
Re: Global symbol probs...
by dragonchild (Archbishop) on Aug 07, 2003 at 14:29 UTC |