[Purdue-pm] smart matching in Perl

Joe Kline gizmo at purdue.edu
Fri Feb 25 17:27:47 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/25/2011 03:29 PM, Mark Senn wrote:
> The '~~' is used to do smart matching in Perl.  I like smart match.
> 
> I'm working on a program that needs to run on Perl 5.10 and 5.12 (don't
> ask).  I'd love to use Perl's smart match to do it but that won't work
> in 5.10.  Below is a program to demonstrate two ways of getting an
> answer.  I don't claim either of these are optimal.    -mark
> 
> #!/usr/local/bin/perl
> 
> @re = (
>     qr /^a$/,
>     qr /^b$/
> );
> 

(forgot to send to the list...)

Mark,

which version of 5.10 are you using?

There is a bug in 5.10.0 that doesn't handle an array of compiled
regexes properly.

It was fixed in 5.10.1.

That's just a guess on my part (from personal experience)

http://perlmonks.com/?node_id=880672

joe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1oVxEACgkQb0mzA2gRTpm/MACfYNVHcx1KZIqOaGJz9kMJkBLq
NhUAn2SBNAl4mDKOlseXzgC2IUS2fDHf
=bSvP
-----END PGP SIGNATURE-----


More information about the Purdue-pm mailing list