Re: searching an array reference

2005-07-16 Thread John W. Krahn
John W. Krahn wrote: Angie Ahl wrote: I've got a way to do this but I thought someone more experienced than me might have a better way. I have a class that is a hash and one of the hash values is an array ref. I'd like to search that array and push to it if a value isn't there. At the moment

Re: searching an array reference

2005-07-16 Thread John W. Krahn
Angie Ahl wrote: > Hi List Hello, > I've got a way to do this but I thought someone more experienced than > me might have a better way. > > I have a class that is a hash and one of the hash values is an array ref. > > I'd like to search that array and push to it if a value isn't there. > At the

Re: searching an array reference

2005-07-16 Thread Peter Rabbitson
> I'd like to search that array and push to it if a value isn't there. > At the moment I'm dereferencing the array, searching/pushing it and > the passing it back to the class as an array ref again. So this mean > copying the array. Code: > > my @used_images = @{$_[0]->{_used_images}}; > foreach (