in reply to Re^3: Splitting file path
in thread Splitting file path

ok. Perhaps it was a poor job explaining on my part. so we have a var called $hardPath. E.g \\test So what I would like to do is build an array of any sub directories within $hardPath. E.g $hardPath\foo\bar So then the array would contain foo, and bar. Does that make sense?

Replies are listed 'Best First'.
Re^5: Splitting file path
by ikegami (Patriarch) on Feb 11, 2010 at 16:24 UTC

    Doesn't the code in Re: Splitting file path do that?

    Well, it sounds like you want just the file name of of the directories, not the whole path. I don't see how this could be useful, but if that's what you want, use File::Basename's basename:

    use File::Find::Rule qw( ); use File::Basename qw( basename ); my @subdirs = map basename($_), File::Find::Rule->directory->in($hardPath);