Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The file was generated by WWW::Mechanize, and I want to decode the string above, so i made a script :Thomas Ack\x26#39\x3Bhing
And failed, not sure why#!/usr/bin/perl use strict; use warnings; use HTML::Entities; open my $fh, '<', 'source.html' or die $!; my $string = do { local $/; <$fh> }; print decode_entities( $string);
But when i tried this code (put the string inside the script)
#!/usr/bin/perl use strict; use warnings; use HTML::Entities; my $string = "Thomas Ack\x26#39\x3Bhing"; print decode_entities( $string); #Output: Thomas Ack'hing
So anyone have a solution for the problem ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: decode characters from file using HTML::Entities
by ikegami (Patriarch) on Feb 18, 2011 at 16:18 UTC | |
by Anonymous Monk on Feb 18, 2011 at 16:37 UTC | |
by ikegami (Patriarch) on Feb 18, 2011 at 19:46 UTC |