in reply to Path parsing from full to relative
You can profit the File::Spec core module and specifically splitpath and splitdir but also catfile functions. Like in:
my $path = 'C:\somedirectory\anotherDirectory\WorkingDirectory\myFile. +txt'; my ($volume,$directories,$file) = File::Spec->splitpath( $path ); my @dirs = File::Spec->splitdir( $directories ); my $partial = = File::Spec->catfile( $dirs[-1], $file );
The above code does what you ask about "trim it down to the last folder" but your desired output is not "trim it down to the last folder"
For this you can just use some regex like /(\\WorkingDirectory.*)$/ and find in $1 what you want.
Or for a more robust solution modify my first code to grab one or more directories to include.
L*
|
|---|