in reply to Re: Swapping Two Hash Values
in thread Swapping Two Hash Values

The simplest way I know to swap values for hash keys is with a slice:

That's what he tried to do. He just got the syntax wrong.

Cody, instead of

$hash{$item,($item -1)} = $hash{ ($item -1), $item};
try
@hash{$item, ($item - 1)} = @hash{($item - 1), $item};
Pay careful attention to the sigils. You have to use an @ to specify a slice.

-sauoq
"My two cents aren't worth a dime.";