On Fri, Jul 2, 2010 at 11:02, David Golden <xda...@gmail.com> wrote: > On Fri, Jul 2, 2010 at 9:30 AM, Chas. Owens <chas.ow...@gmail.com> wrote: >> Lets take a quick look at what it would really look like. I chose >> substr at random and updated it to fit scenario 3. It took four > > At the risk of cherry picking my examples, try: > > * exec > * localtime > * split > > Below, I'll do an except bit of the latter. Consider these possible > reactions: > > * What is "use 5.010"? > * You mean I have to type "use 5.010" whenever I use "split"? > * Why is it sometimes "use 5.010" and sometimes "use 5.005"? > > None of these have anything do with understanding 'split' -- so I > don't think it adds value. > > Here is my example from 'split' in perlfunc: > ... > use 5.010; > say join(':', split(/ */, 'hi there')); > > use 5.010; > say join(':', split(//, 'hi there')); > > use 5.010; > say join(':', split(/(?=\w)/, 'hi there!')); > > use 5.010; > say join(':', split(//, 'hi there!', -1)); > say join(':', split(/\W/, 'hi there!', -1)); > > use 5.005; > ($login, $passwd, $remainder) = split(/:/, $_, 3); > > use 5.005; > split(/([,-])/, "1-10,20", 3); snip
The use statements should be explained at the top of the document (I know I already argued that nobody reads those, but they are important for explain things like style), and most of those examples would not have a use statement under my proposal. Only examples that are longer than one line are targeted for use statements. Also, most of them could be rephrased to avoid the print or say in the first place (removing the most pressing need for a use statement). -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read.