A big thank you to everyone who replied to this post, especially those of you who steered me towards using grep instead of map. It has tied up my code nicely. I have not tested the speed of the routines, since the general concensus seemed to be that the same number of iterations would take the same time no matter what loop structure I use.
You can see the results of my latest Perl tinkerings at http://www.team-artonomy.com/scripts/image_engine.html Thanks again fro the feedback. Regards, Richard -- > I have too version of a routine that iterates through > about 140 elements of an array. I am trying to make > the script as efficient as possible (obviously), and I > have 2 versions of a routine that does a bitwise > comparison to match a filter. Can anyone tell me just > by looking which is likely to be fater? My guess is > the map version: > > 1. loop version: > > for (@image_list) { > ( int( $filter ) & int( $image_data{$_}[2] ) ) == > $filter and push @match, $_; > } > > 2. Map version: > > @match = map { ( int( $filter ) & int( > $image_data{$_}[2] ) ) == $filter and $_ or () } > @image_list; > > Any thoughts much appreciated. __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com