for (@array) { my $extract = substr($_,rindex($_,')')+1 ); # everything after the last paren is interesting $extract=~ s/\s+//gs; # remove spaces print "$extract\n"; # or do something else }