in reply to Re: Help with HTML::TableExtract
in thread Help with HTML::TableExtract

Thanks Corion. I am not too sure how to rewrite javascript in perl. Is there any resource you can point me to ? Thanks

Replies are listed 'Best First'.
Re^3: Help with HTML::TableExtract
by AppleFritter (Vicar) on Mar 12, 2015 at 10:19 UTC

    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> $
Re^3: Help with HTML::TableExtract
by Corion (Patriarch) on Mar 12, 2015 at 09:38 UTC

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