First off, you'll want to learn how to post here. If you put your code between "<code>" and "</code>" tags, then normal code punctuation is escaped for you. So this:
my ($i); for ($i = 0;
($i < int (@commandsProperOrder));
$i += 2) { $commandsProperOrder{$commandsProperOrder$i}
= $commandsProperOrder$i + 1; }
looks like this:
my ($i);
for ($i = 0; ($i < int (@commandsProperOrder)); $i += 2) {
$commandsProperOrder{$commandsProperOrder[$i]}
= $commandsProperOrder[$i + 1];
}
(OK, I had to break some lines because of the long variable names, but otherwise it came out as typed.)
Second, I'd guess that the array @commands has a list of pairs, and that the code is trying to put those pairs into the hash %commands. Normally you want to know (or check) that your array is appropriate for this, but hash stuffing is more easily done with:
%commands = @commands;
No $is, etc., just Perl magic.
This works because a list can be assigned to a hash, and it will (sometimes) do the right thing. (It's certainly no worse than the code you posted.) [When you're ready, just ask, someone will tell you when and why it doesn't do the right thing.]
-QM
--
Quantum Mechanics: The dreams stuff is made of
| [reply] [d/l] [select] |