in reply to How do i take the first 4 characters of any file name in a specified directory?

You can use 'printf' function for printing the first 4 characters of a file name. For eg.
opendir(DIR, "/tmp") || die "can't opendir $!"; while (my $file = readdir(DIR)) { next unless (-f "/tmp/$file"); printf '%.4s', $file; } closedir DIR;
  • Comment on Re: How do i take the first 4 characters of any file name in a specified directory?
  • Download Code