how do i match a particular alphabet using regexp?
I cannot print the second occurrence of 'a' in my string
in the following piece of code,as a beginner I cannot find where the problem is and why it is happening?
#! usr/bin/perl
use warnings;
use strict;
my @vars;
$_='1: A a A silly a sentence a (495,a) *BUT* one a which is a will be
+ useful. (3)';
if (@vars= /(\s)(a)(\s)/ig){
print "the text matches the pattern '\$pattern'.\n";
foreach (@vars) {
print "Group: $_\n";
}
}
else {
print " it was not found. \n";
}
print "@vars\n";