I
inderpaul_s
I have the following code...my only question is in line 4. where you
see the ^ and $ (last one) character which means start/end of the
string. But my question is where does it stop matching for the caret
and the dollar sign ?
I think the caret is everything from the beginning of the string all
the way to the end and same when matching from the end of the line it
matches everything to the start of the string. There is nothing to tell
it to stop ? Does this sound correct ?
1. my $line = "jsmithassword \n";
2. my $user = "jsmith";
3. my $password = "password";
4. if($line =~ /^$user:$password$/)
5. {print "user name and password match\n";}
6. else{print "user name and password does NOT match\n";}
see the ^ and $ (last one) character which means start/end of the
string. But my question is where does it stop matching for the caret
and the dollar sign ?
I think the caret is everything from the beginning of the string all
the way to the end and same when matching from the end of the line it
matches everything to the start of the string. There is nothing to tell
it to stop ? Does this sound correct ?
1. my $line = "jsmithassword \n";
2. my $user = "jsmith";
3. my $password = "password";
4. if($line =~ /^$user:$password$/)
5. {print "user name and password match\n";}
6. else{print "user name and password does NOT match\n";}