Thursday, March 25, 2010

perl's pattern matching enhanced by "named capture buffers"

python has long had it: symbolic groups. They allow you to refer to a substring matched by a symbolic group name: "(?P<id>)", id in this case. Now perl has drawn equal: "(?<id>)" does the same job, and the feature is called named capture buffers. Read it up in the perlre manual page or online here! Basically the pieces go to "%+", i.e. a hash array by the name of "+". 

No comments: