HI

Sombody help me if i give ([a-z]+)(.*)([a-z]+) as input string output i get
is

$1 is 'silly'
$2 is 'silly'
$3 is 'silly'

this is wrong  according to be book i refer
please somone clarify me code i used is as below

use strict;
use warnings;

$_ = '1: A silly sentence (495,a) *BUT* one which will be useful. (3)';

print "Enter a regular expression:";
my $pattern = <STDIN>;
chomp($pattern);
if(/$pattern/){
print "The text matches the pattern '$pattern'.\n";
print "\$1 is '$1'\n" if defined $1;
print "\$2 is '$1'\n" if defined $2;
print "\$3 is '$1'\n" if defined $3;
print "\$4 is '$1'\n" if defined $4;
print "\$5 is '$1'\n" if defined $5;
}else{
print "'$pattern' was not found.\n";
}

Reply via email to