Stuart Clark wrote:
> 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})/;
The regular expressions will try to match the contents of $_ here. From your
previous posts I guess
you want to do the match on $CreditCard. The statement should be
$VisaCard = $CreditCard =~ /^4\d{15}/;
$VisaCard will either be 1 (true match) or undef if the match fails.
>
>
>
>
> if ($Charge > 0 && (($VisaCard|$BankCard),$CreditCard) ) { # This bit
> doesn't work?
>
> Print "The credit card number 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?
Yes that's ok
>
> If so what would be the syntax for or "if (blah or blah)"
>
if (blah || blah)
>
> Regards
> Stuart Clark
>
HTH,
Sudarsan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]