in reply to Re: array and hash
in thread array and hash

Of course, there are tons of different ways to do something like this.

You could store the results in a hash rather than array, if inputs are all unique strings:

my %results; for ( @array ) { $results{$_} = some_func($_); }
You could make the results array contain hash-based records instead of array-based:
my @results; for ( @array ) { push @results, { input => $_, output => some_func($_) }; }
Etc. There's also shortcuts for the loop:
my %results = map { ( $_ => some_func($_) ) } @array;
my @results = map { { input => $_, output => some_func($_) } } @array;
Etc.