You say $htmlLines[$i] but that subroutine has no $i, and in the main program it gets declared further down.
When you mean "last element of array, it is better to write $#htmlLines rather than @htmlLines-1.
Also, avoiding using indices when you could do without.
Lastly, your scrapTag procedure is pretty defective with regards to valid HTML. You should parse the HTML, not just look for character sequences. Use one of the many excellent modules for that purposes - I recommend HTML::TokeParser::Simple:for my $line (@htmlLines) { print $line; }
use warnings; use strict; use HTML::TokeParser::Simple; my $file = "E:\\Documents and Settings\\Richard Lamb\\My Documents\\HT +MLworkspace\\HTML practice\\My First Page!\\firsttest\.html"; my $parser = HTML::TokeParserSimple->new($file) or die "Can't open $file: $!\n"; while ( my $token = $p->get_token ) { next if $token->is_tag('img'); print $token->as_is; }
Makeshifts last the longest.
In reply to Re: HTML image tag stripping
by Aristotle
in thread HTML image tag stripping
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |