develooper Front page | perl.beginners | Postings from February 2002

more reg exp help please

Thread Next
From:
Stuart Clark
Date:
February 7, 2002 05:11
Subject:
more reg exp help please
Message ID:
000801c1afd8$dc8a6a60$b945a4cb@yogi
Hi all,
Can anyone help please?
 
# example values
$Charge = "55";
$CreditCard = "423452345654532";
 
 
$VisaCard = /^4\d{15}/;
$BankCard = /^(6565\d{12})|(555[10]00\d{10})/;
 
 
 
if ($Charge > 0 && (($VisaCard|$BankCard),$CreditCard) ) { # This bit
doesn't work?
      Print "The credit card is valid and the transaction is a sale";
}elsif ($CreditCard = "" && $Charge < 0 ) { # Is "" ok for a null entry?
Print "No Credit card entered and the transaction is a refund";
}
  
Also is the "if (blah && blah)" bit ok?
If so what would be the syntax for or "if (blah or blah)"
 
Thanks for helping me if you can.
Regards
Stuart Clark
 
 

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About