Friday August 23, 2002

For you Perl putterers they have published Exegesis 5 over at Perl.com, which outlines the changes to regular expressions coming in Perl 6. Regex's, for those who have shyfully avoided them, are a great and wonderful thing albeit strange and scary when you first encounter them.

%hash = ( $lines =~ /^\s*(.+?)\s*=\s*([^#]+?)$/mg );

Which of course pulls out all of the value pairs (key=val) in a multiline variable, removes any leading and trailing whitespace (ignoring trailing comments, seems that trailing space between val and comments isn't stripped), and pops each of them into a hash. Yummy.