in reply to How do i take the first 4 characters of any file name in a specified directory?
opendir(DIR, "/tmp") || die "can't opendir $!"; while (my $file = readdir(DIR)) { next unless (-f "/tmp/$file"); printf '%.4s', $file; } closedir DIR; [download]