Software >> Development >> Languages >> Perl >> How to extract directory from path info

$path =~ s/\[^\]*$//gi;