if i have a fully qualified path nams stored in a variable and i want to extract only a part of it.What should i use?example:$area_path=templatedata\eGeekZoneTest\DT1\data\data1;And want to extract templatedata\eGeekZoneTest\DT1
...$area_path =~ tr|\\|/|; # fix slashes$area_path =~ s|/data/.*$||;...
...(my $apath = $area_path) =~ tr|\\|/|; # fix slashes$apath =~ s|/data/.*$||;...
Can use any of the following, however you should be known what you have as input to segragate the parts:1. Regular expression like $area_path=templatedata\eGeekZoneTest\DT1\data\data1;$area_path =~ m/(.*)\/DT1/data/data1/;
This is exactly why I always make sure to fix the slashes first and always use forward-slashes. The above code is broken.
There are cases where you would like to keep OS original convention whatever it may be. Simple regex class serves well in such case:$area_path =~ m|(.*)[\\/]DT1[\\/]data[\\/]data1|;