in reply to Shortest -return index of element in array- sub
What if we want to find all of the values? The best I could do was this,
Dean
Good Day,sub find { 1 while $_[0]ne pop; $#_+1?(&a(@_),$#_):(); } my @array=('john','paul','ringo','george', 'ringo'); print &find('john',@array),"\n"; # Returns 0 print &find('ringo',@array),"\n"; # Returns 24 print &find('mick',@array),"\n"; # Returns undef
Dean
In Section
Cool Uses for Perl