I have this problem a lot, and I've always written around it since I didn't know you could specify a negative limit and get all the trailing empties.

Pretty much the defining characteristic of Perl -- the real Perl that is; not a bastardised, pseudo-sanitised subset, nor an orthoganised, pseudo-java superset that the "modern" crowd would try to sell you on -- is that the built-ins are very well designed to deal with all the variations that you will ever need.

Many languages now have a split in their libraries, but none of them cater to all the common variations and edge cases the way Perl's does.

It was when early in my use of Perl: I repeatedly found myself needing to do something that I knew was going to be awkward and messy to deal with, only to find that Perl's designer(s) had been there before me, recognised the need and catered for it; that caused me to pin the Perl documentation in my browser for quick reference.

It's still there 13 years later. I don't have to look so often as I once did; but I am still discovering the purpose of stuff that I've read many times, but took no notice of because I didn't need it at that time, but that has been sitting there dormant just waiting for my need.

And it is that that brings me back to Perl time and time again. I'm currently trailing yet another new language -- this time Julia -- to replace my reliance on Perl. It is very cool language that acts exactly as a RELP-able, interpreted language; that when stressed, JITs into a near-C speed demon. But I recently spent a week trying to code something from scratch in Julia; that when I got frustrated took me 37 minutes from start to finish in Perl.

Even with the working Perl example and a 2/3rds complete Julia version it took 3 more days to get the Julia version working because of the need to manually code all the special cases that Perl takes care of for me. The result ran 13x faster, which in the long run of process that will run for months, is a huge saving and well worth the effort; but it will still be a long time before I give up Perl 5.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^3: Do I have to trick Split? by BrowserUk
in thread Do I have to trick Split? by $h4X4_|=73}{

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.