# method 1 @matches = $string =~ m{/(.*?)/}g; # method 2 @matches = split m{/}, $string; # print the one you want print $matches[1];