From: Chad Perrin Date: 2011-05-05T05:50:31+09:00 Subject: Re: Iterating over an Array of Hashes --xHFwDpU9dbj6ez1V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 05, 2011 at 04:17:53AM +0900, Christopher Dicely wrote: >=20 > The #clone based method presented upthread (which wasn't mine, it was > 7stud's) works perfectly for the data and requirements presented. It > doesn't work if, in addition to wanting to lose changes to the passed > hashes, one also wants to lose any changes resulting from manipulation > of the data in the hashes, but that wasn't requested. Are you seriously claiming that the person's statements seemed to you to indicate a desire for the data to change in the original data structure? Seriously? >=20 > That is, since you work on a local copy of each hash, mutating methods > called on the hash won't have any lasting effect, but mutating methods > called on keys or values extracted from the (local copy of the) hash > will affect the objects stored in the original hash. Avoiding this kind > of effect was not requested. It really seemed implied from where I was sitting. >=20 > Sure, but its way overkill for it. You only need deep copies if you > have requirements that weren't stated (avoiding effects from mutating > methods called not on the hashes being passed but on the keys or values > of the hashes.) I'm not sure why you're so pedantically splitting hairs when the actual intent seemed pretty obvious: no changes. > > > > 2. Is there some less-convoluted approach that works for the more > > complex needs you presented? >=20 > I'm not sure what relevance this has. I think you're playing dumb. --=20 Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --xHFwDpU9dbj6ez1V Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk3BuOoACgkQ9mn/Pj01uKX2XwCdHe6vPhY3PfKDsoZVtQZkQTkv 8+0AoPBJ1tDOp7fkYZ/rHVm33ApP/1Ok =sZg4 -----END PGP SIGNATURE----- --xHFwDpU9dbj6ez1V--