4 Replies Latest reply on Mar 3, 2011 2:30 AM by Liphou


    Liphou Level 2



      Est-il possible de faire une liste de HACHAGE (Perl) en JavaScript!




      Translation FR -> EN




      Is it possible to make a list of HACHAGE (Perl) in JavaScript!


      Thank you

        • 1. Re: [JS] HACHAGE PERL
          John Hawkinson Level 5

          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
            Liphou Level 2

            Il y a très longtemps que j'ai fais du per et je converti un script Perl en Javasccript


            la variable $clubno (Number) et $ville (String)


            A long time ago that I'm doing and I converted a per script Perl Javasccript


            Variable $ clubno (Number) and $ville (String)






            • 3. Re: [JS] HACHAGE PERL
              John Hawkinson Level 5

              Sure, no problem:


              var nomclub = {},
                  clubno, ville, villeclub;
              // ...
              nomclub[clubno] = ville;
              // ...
              villeclub = nomclub[clubno];


              Any questions?

              • 4. Re: [JS] HACHAGE PERL
                Liphou Level 2

                Merci je vais testé cela se soir.


                Thank you I'll be tested this evening.