in reply to Read a list of files into an array

Do you want the array to contain the names of all the text files in the directory? Something like:
#! /usr/bin/perl use strict; use warnings; my $dir = "/root/dir"; opendir(BIN, $dir) or die "Can't open $dir: $!"; my @array = grep { -T "$dir/$_" } readdir BIN;

Caution: Contents may have been coded under pressure.