in reply to Help with HTML::TableExtract

You will need to learn how Javascript and HTML interact. The email is decoded from the Javascript string.

Either you learn how to rewrite the Javascript algorithm in Perl or you run the Javascript code and fetch its result.

I recommend rewriting the Javascript algorithm in Perl.

Replies are listed 'Best First'.
Re^2: Help with HTML::TableExtract
by saeen (Novice) on Mar 12, 2015 at 09:35 UTC
    Thanks Corion. I am not too sure how to rewrite javascript in perl. Is there any resource you can point me to ? Thanks

      It's pretty straightforward in this case. The Javascript code in question is something along these lines:

      var s='=b!isfg>(fybnqmfAfybnqmf/dpn(?fybnqmfAfybnqmf/dpn=0b?';var i;fo +r (i=0;i<s.length;i++) document.write( String.fromCharCode(s.charCode +At(i)-1));

      Even not knowing any Javascript it's not too difficult to tell what this does: it goes through the string one character at a time, and maps each character to the preceding character (in whatever character set Javascript uses by default).

      You could do the same in Perl more or less verbatim (using the chr and ord functions), but instead of using a loop, it's perhaps more idiomatic to resort to split, map and join:

      #!/usr/bin/perl use strict; use warnings; use feature qw/say/; my $s = '=b!isfg>(fybnqmfAfybnqmf/dpn(?fybnqmfAfybnqmf/dpn=0b?'; say join "", map { chr(ord($_) - 1) } split //, $s;

      This outputs:

      $ perl 1119765.pl <a href='example@example.com'>example@example.com</a> $

      I would look at the MDN, but that requires that you already know enough Javascript.