http://qs321.pair.com?node_id=91784


in reply to Re: Splitting each word in a string
in thread Splitting each word in a string

trailing empty fields are removed - just like in awk. Which doesn't happen if you use /\s+/ as first argument

No, the default case is different from /\s+/ in that a leading empty field is ignored. The only way to get Perl to not strip trailing empty fields is to pass a 3rd argument to split, usually -1.

I won't complain about you having wasted my time by getting this wrong. This isn't comp.lang.perl.* and most of us like it that way. If you want to complain about people wasting your time, then comp.lang.perl.* is probably a better forum for you.

We're all here to have fun and there are plenty of us to answer questions quite correctly as well as incorrectly (and lots of shades of grey in between) and then discuss the results. Many of us end up learning a lot of Perl in the process, but such isn't the only purpose.

Sure, checking your answers before you post is prudent and polite, but so is not grousing at people when they make a mistake.

Have the appropriate amount of fun...

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re: Splitting each word in a string