ok, I found my error, it should be as follows if I want to match number 6:-
my $_ = 62; if( $_ =~ /^6$/){

----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <beginners@perl.org>
Sent: Wednesday, April 02, 2008 5:07 PM
Subject: simple reg ex matching


Hi,
The value of $_ is 62. In the script below, I just wonder why the default variable match the number 6. What I wanted to say is that if the default variable $_ holding the value of 62, if match the number 6, then print Yes match. So what is the right way to right.
Thanks

use strict;
use warnings;

my $_ = 62;

if( $_ =~ /6/){
print "Yes match \n";
}else{print "no"};

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to