Question: Using Perl, if I have a string that includes the full path to a file (i.e., it includes both the full path of the directory and the filename), how do I split the string into its directory and filename components?
Answer: Use the
dirname methods of the Perl
The following example shows how to break this string
'/Users/al/work/file1.pdf' into its directory and filename components: