> Properties *can* be smart-matched: > > print "creditcard" if $var.prop().{CreditCard} ~~ 'VISA'; > or: > print "creditcard" if $var.prop{CreditCard} ~~ 'VISA'; > or: > print "creditcard" if $var.CreditCard ~~ 'VISA'; > > Damian >
I think this is similar to "John Williams" suggestion: print "creditcard" if CreditCard( $var ) eq 'VISA'; It is something different to scan a database of card types and return a list of possible matches, instead of just testing one requested card type. What if CreditCard is such a routine sub CreditCard { #connect to a "specific" database (VISA, MASTERCARD, ..) #compare with "non-blocked or valid" cards } or sub CreditCard { #cycle through all 800 CreditCard types and return matches } Then Damians suggetion > print "creditcard" if $var.CreditCard ~~ 'VISA'; could mean heavy processing, but print "creditcard" if $var ~~ CreditCard( 'VISA' ); would be short work. Excerpt: My concept is to have a twofold view about "properties". One thing that is attributing a type during decleration, and something that could verified against in other context. All my thinking on that orginates from Damians Attribute::Type. Hopefully i do not confuse you too much. Murat