#!/usr/bin/perl
use strict;
use warnings;
use feature "say"; #I want to use say

my $x = "the quick brown fox ";
say $x =~ /o./; #makes '1' - there is a match, and scalar context
say $x =~ /o./g; #makes 'owox' - assume array context and return 
    # all matches, being the ow and the ox
    # Perl copied the list of matches into the string $x
    # since called in scalar context though, hence 'owox'

my @m = $x =~ /o./;
say "@m";	#'1' - the return was 1, since a match and not global
@m = $x =~ /o./g; #array context & global so matches go into the array
say @m;		#'owox' - /g causes a list to be returned

while ($x =~ /(o.)/g) {
    say "Matched $1";
}
# the while will generate
# Matched ow
# Matched ox
