in reply to Regex output incorrect

Original OP
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";

gives me incorrect output: /aboutiso/corp_gov

I'm trying to print /aboutiso/corp_gov/bod/agendas

No, it doesn't print that.

Based on what you posted, you want to remove the trailing "/2010/", so

$folder_path =~ s{/[^/]*/\z}{};