in reply to I'm struggling with a function, and hoping for some insight -- not strictly Perl
$w('A B C D E F G H J K L M N P Q R T U V W Y 3 4 6 7 8 9').each( function(d){ map[d] = dv++; } );
^^ This looks very similar to jQuery syntax for looping over DOM elements. For example you could loop over all "div" elements of a web page, and do something with each of them, using this jQuery syntax:
$( "div" ).each(function(i) { // in here, 'this' can be used to refer to the current DOM // element, whereas 'i' contains the loop index });
$ is not a sigil, it is the name of a function defined by the jQuery library.
In your code, a similar-behaving function called $w is used. It will probably help your reverse-engineering effort if you could find out where that function is defined, and what exactly it does.
Update: Looks like it may be simply doing what Perl's qw(...) quote-like operator does...
Edit: Moved Perl translation and high-level discussion to a separate answer.
|
|---|