Why make two passes?

D:\Perl\test>perl use strict; use warnings; my %h; @h{'a'..'j'} = 0..9; print %h, $/; my ($min,$max) = (keys %h); ($min,$max) = ( $h{$min} < $h{$_} ? $min : $_, $h{$max} > $h{$_} ? $ma +x : $_ ) for keys %h; @h{$min,$max} = @h{$max,$min}; print %h, $/; ^Z a0b1c2d3e4f5g6h7i8j9 a9b1c2d3e4f5g6h7i8j0

Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.

In reply to Re: Re: Interchanging hash values by BrowserUk
in thread Interchanging hash values by mjab

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":