David Farrell has released a really good article on Perl's split.
http://perltricks.com/article/121/2014/10/24/Perl-s-versatile-split-function
Unfortunately, he left off one of my favorite features: the third
argument.
my ($key, $value) = split /:/, $line, 2;
This works much better than something I've seen repeatedly
my ($key, $value) = split /:/, $line;
when the input line looks like: "plugin:Module::Name"
If you didn't multi-part module names, you're going to get a surprise in
the second case. But, by supplying the third parameter, we can make
split give us what we need.
G. Wade
--
Controlling complexity is the essence of computer programming
-- Brian Kernighan
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/