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


in reply to regular expression for workdir

This would be more straightforward than the other suggestions:

my ($subpath) = $path =~ m|$magic_word/(.*)/.*|; print $subpath, $/;

Update:

Rereading the question, I misinterpreted it, since my solution will gather all directories after the magic word.
Go with wfsp's solution which fits in perfectly.