%hash = map {/=(\w+)/; $` => $1} ; foreach (sort keys %hash){ print "$_ $hash{$_}\n"; } __DATA__ A=hello B=world B=planet C=universe