in reply to split function against a HTML code
On another note, what is it you are trying to accomplish by splitting on '>'? Are you trying to get at each HTML tag, or a certain tag? Is this HTML trustworthy? Your code may not give you the result you expect if the HTML isn't valid and is missing a > or has an extra > in there. Just something to consider.my $file = 'blah.html'; # Slurp the file contents into one big string open my $fh, '<', $file or die "Cannot open $file: $!"; my $str = do { local $/; <$fh>; }; close $fh; # Split on '>' my @results = split '>', $str; print "Check :", $#results, "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: split function against a HTML code
by greatshots (Pilgrim) on Nov 26, 2007 at 06:44 UTC | |
by mreece (Friar) on Nov 26, 2007 at 15:28 UTC | |
|
Re^2: split function against a HTML code
by greatshots (Pilgrim) on Nov 26, 2007 at 08:59 UTC |