On Feb 8, Stuart Clark said:

>$Charge = "55";
>$CreditCard = "423452345654532";
> 
> 
>$VisaCard = /^4\d{15}/;
>$BankCard = /^(6565\d{12})|(555[10]00\d{10})/;

You can't store regexes that way.  You need to use the qr// operator.

  $VisaCard = qr/^4\d{15}$/;
  # likewise for $BankCard

>if ($Charge > 0 && (($VisaCard|$BankCard),$CreditCard) ) { # This bit
>doesn't work?

  if ($Charge > 0 and ($CreditCard =~ $VisaCard or $CreditCard =~ $BankCard)) {
    # it's ok
  }

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to