I wonder if there's a better way of doing it?
It depends... Assuming there are no duplicate names, I would create a hash once populated with the names as keys and the object refs as values.
my %objects_by_name; for (@obj_fw) { $objects_by_name{$_->name} = $_ }
or even better right when the objects are being created/given names.
From then on you get the objects by name from $objects_by_name{$name}
Cheers, Sören
Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)
In reply to Re: OO search in objects
by Happy-the-monk
in thread OO search in objects
by Hossein
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |