http://www.perlmonks.org?node_id=35582


in reply to How do I extract a file name from a path string

open FILES, "dir /b /aa /s |" or die; while ( <FILES> ) { my( $dir, $file ) = /(.+)\\(.+)/; defined $file or next; # no path separator print "$dir => $file\n"; } close FILES;