> or u can use :
>
> if($password =~ /^howard$/)
> {
> ## logic goes here
> }
>
> ----------
> From: James Edward Gray II[SMTP:[EMAIL PROTECTED]
> Sent: Saturday, June 14, 2003 8:58 PM
> To: deborah
> Cc: [EMAIL PROTECTED]
> Subject: Re: beginner "if statement" question
>
> On Saturday, June 14, 2003, at 10:01 AM, deborah wrote:
>
> > In the same line as my last question.... once I tried to understand
> > how Perl was interpreting string comparisons, I started experimenting
> > with different strings.
> >
> > What is Perl doing here? Why doesn't it use the "if" statement as a
> > condition? It reassigns the variable value instead of using it as a
> > conditional statement in the following code:
> >
> > $password=bill;
> > if ($password = 'howard') {
>
> = is Perl's assignment operator. This means set $password to 'howard'.
> I believe your were looking for == which is a logical comparison
> operator, but unfortunately, that still wouldn't do the trick. == is
> for comparing the equality of numbers, but you want to compare two
> strings. For that you need Perl's string comparison operator, eq. So
> to fix the line above try:
>
> if ($password eq 'howard') {
>
> Hope that helps.
>
> James
>
> > print "'$password' is a valid password.\n";
> > }else {
> > print "'$password' is not valid.\n";
> > }
> >
> > *******
> > This results in a printout that says: 'howard' is a valid password.
> >
> > Thank you again,
> >
> > Deborah
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
____________________________________________
Confidential: This electronic message and all contents contain information
from Syntel, Inc. which may be privileged, confidential or otherwise
protected from disclosure. The information is intended to be for the
addressee only. If you are not the addressee, any disclosure, copy,
distribution or use of the contents of this message is prohibited. If you
have received this electronic message in error, please notify the sender
immediately and destroy the original message and all copies.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]