This content has been marked as final.
Show 4 replies
-
1. Re: [JS] HACHAGE PERL
John Hawkinson Mar 3, 2011 1:35 AM (in response to Philippe Ruelle)Sorry, I do not think your translation is working properly. What is "HACHANE" in perl? Can you show us an example of the perl code?
If you asking about hash in perl, also known as an associative array, then those are Objects in Javascript.
In perl:
$days{'Feb'} # the 'Feb' value from hash %days %days # (key1, val1, key2, val2 ...) %map = ( red => 0x00f, blue => 0x0f0, green => 0xf00, );Then in JavaScript:
var days = {}; // Empty Object var days = { key1: val1, key2: val2, ... }; // initialize w/ object literal var map = { red: 0x00f, blue: 0x0f0, green: 0xf00 }; alert(map["red"]); // one syntax alert(map.red); // alternate syntax var i; for (i in map) { if (map.hasOwnProperty(i)) { alert("The color " + i + " maps to the value " + map[i]); } }Is that helpful? Examples PLEASE!.
-
2. Re: [JS] HACHAGE PERL
Philippe Ruelle Mar 3, 2011 1:51 AM (in response to John Hawkinson)
Il y a très longtemps que j'ai fais du per et je converti un script Perl en Javasccriptla variable $clubno (Number) et $ville (String)
A long time ago that I'm doing and I converted a per script Perl JavasccriptVariable $ clubno (Number) and $ville (String)
$nomclub{$clubno}=$ville;
……
…
……
$villeclub=$nomclub{$clubno}; -
3. Re: [JS] HACHAGE PERL
John Hawkinson Mar 3, 2011 2:17 AM (in response to Philippe Ruelle)Sure, no problem:
var nomclub = {}, clubno, ville, villeclub; // ... nomclub[clubno] = ville; // ... villeclub = nomclub[clubno];Any questions?
-
4. Re: [JS] HACHAGE PERL
Philippe Ruelle Mar 3, 2011 2:30 AM (in response to John Hawkinson)Merci je vais testé cela se soir.
Thank you I'll be tested this evening.



