my $str = "foo bar baz"; print "[", $str =~ /\w+ /, "]", $/; # list no capture print "[", $str =~ /\w+ /g, "]", $/; # list no capture + /g print "[", $str =~ /(\w+) /, "]", $/; # list and capture print "[". $str =~ /\w+ /, "]", $/; # scalar __output__ [1] [foo bar ] [foo] [1]