Мне кажется, что в этом куске документации ничего не сказано про это поведение.<br><br><div class="gmail_quote">2012/10/1 iSage <span dir="ltr"><<a href="mailto:isage@aumi.ru" target="_blank">isage@aumi.ru</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>Знаем. Только если аргументом хэш. И об этом сказано в документации.</p>
<p style="padding-left:30px">This operator is also handy for inverting a hash, although there are some caveats. If a value is duplicated in the original hash, only one of those can be represented as a key in the inverted hash. <b>Also, this has to unwind one hash and build a whole new one</b>, which may take some time on a large hash, such as from a DBM file.</p>
<div class="HOEnZb"><div class="h5">
<p>On Mon, 1 Oct 2012 19:20:52 +0400, Denis Evdokimov <<a href="mailto:evdokimov.denis@gmail.com" target="_blank">evdokimov.denis@gmail.com</a>> wrote:</p>
<blockquote type="cite" style="padding-left:5px;border-left:#1010ff 2px solid;margin-left:5px;width:100%">
<p>А знаете ли вы, что reverse изменяет свой агрумент?<br>В этом легко убедиться с помощью JSON или Devel::Peek :<br><br>perl -MJSON -e'my %a=(int => 222); print to_json \%a; my %b=reverse %a; print to_json \%a;'<br>
 {"int":222}{"int":"222"}<br><br>perl -MDevel::Peek -e'my %a=(int => 222); Dump $a{int}; my %b=reverse %a; Dump $a{int};'<br>SV = IV(0x1036d40) at 0x1036d48<br>  REFCNT = 1<br>  FLAGS = (IOK,pIOK)<br>
   IV = 222<br>SV = PVIV(0x1051220) at 0x1036d48<br>  REFCNT = 1<br>  FLAGS = (IOK,POK,pIOK,pPOK)<br>  IV = 222<br>  PV = 0x1056220 "222"\0<br>  CUR = 3<br>  LEN = 8<br><br></p>
</blockquote>
<p> </p></div></div><br>--<br>
Moscow.pm mailing list<br>
<a href="mailto:moscow-pm@pm.org">moscow-pm@pm.org</a> | <a href="http://moscow.pm.org" target="_blank">http://moscow.pm.org</a><br>
<br></blockquote></div><br>