when I realized that I wanted to map field3 to two different things, and that I actually had the keys and values backwards, but conceptually I still wanted the order to be the way I had it (because I was mapping a source to a target, and the source might have more than one target), so to save some typing (there were more than just 3 fields), I changed the hash ref to an array ref, and did a reverse on the array to build a new hash ref. I probably wouldn't do this in a loop; it was just a one time initialization thing. But what I really wanted was to be able to go:my $href = { field1 => 'this', field2 => 'that', field3 => 'another', ...
Any thoughts on whether this is a good idea? Or should I just shut up and reverse my keys and values or the array ref? Duh, I just realized its a 'less than or equal to' operator, but still, could it be easily overloaded (or be some other operator entirely)?my $href = { field1 <= 'this', field2 <= 'that', field3 <= 'another', field3 <= 'YetAnother', ...
In reply to The Oops operator. by runrig
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |