#!/usr/bin/perl -w

# An example of back matching.
use strict;

my @strings;

$strings[0] = "\"In double quotes\"";
$strings[1] = "'single'";
$strings[2] = "'No match\"";


foreach my $str (@strings) {

  if($str =~ /(["'])([\w\s]+)\1\s*/ ) {
     print "Quotes match around $str\n";
  }else {
     print "Fix quotes aroung $str\n";
  }
}


# Notes:
# ["'] - match on one of " or '
# (["']) - remember this for later
# [\w\s]+ - match on one or more occurences of a word character or a space
#           This will stop matching when it hits a non-word, non-space char.
#           Again, the parentheses around it mean remember this for later.
# \1 - match on exactly what the first set of parentheses matched.   




