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

Re: more reg exp help please

Thread Previous
From:
Jeff 'japhy' Pinyan
Date:
February 7, 2002 08:47
Subject:
Re: more reg exp help please
Message ID:
Pine.GSO.4.21.0202071145470.15873-100000@crusoe.crusoe.net
On Feb 8, Stuart Clark said:

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

What is ((A | B), C) trying to do?  Perhaps you want:

  (($VisaCard || $BankCard) && $CreditCard)

>}elsif ($CreditCard = "" && $Charge < 0 ) { # Is "" ok for a null entry?

You need to use eq '', not = ''.  If you use =, you will SET $CreditCard
to the empty string.  You need to COMPARE it with the empty string.

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      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.


Thread Previous


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