use strict; use warnings; my $folder_path = "/aboutiso/corp_gov/bod/agendas/2010/"; my $try = "index.html"; my $test = "$folder_path/$try"; $folder_path =~ s#/\w+/[^/]*.\w+$##; print "folderpath: $folder_path\n";