$test = "mouse_eatsCat_andDog.txt"; $test =~ s/"_(.+)"/$1/; #because I want to get "eatsCat_andDog.txt"