P is for Practical | |
PerlMonks |
Re-reading history from 2001 / using a capture during splitby talexb (Chancellor) |
on Mar 05, 2019 at 16:22 UTC ( [id://1230912]=perlquestion: print w/replies, xml ) | Need Help?? |
talexb has asked for the wisdom of the Perl Monks concerning the following question: I've been part of this community for a while, and it's always fun to check out Selected Best Nodes for pearls (heh) of wisdom. Today I found Being pretentious, and getting away with it., which talked about the behaviour of split with a particular regex. I started writing a module to beautify code recently, and ended up using a capture in a split statement -- which isn't something I do regularly. Here's the interesting part about this subject (finally) .. the example in the node talked about the following behaviour:
Oh. The behaviour has gone back to the previous one. I believe it's because split is splitting on the un-captured 'B', and since it's not captured, undef is the correct result, rather than a null string (with apologies to japhy. Thoughts? EDIT: Updated title to add '/ using a capture during split' to the title, as per feedback.
Back to
Seekers of Perl Wisdom
|
|