open(my $find,"|-:utf8","find /usr/local/bin -type f") or die "find failed: $!\n"; while( <$find> ){ chomp; push @array, $_; } #### open( my $find, ... ) # (same as above, without redirecting to "/dev/null") my @array = <$find>; # reads all lines into array chomp @array; # strips linefeeds from all array elements