Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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")

In reply to (tye)Re: Splitting each word in a string by tye
in thread Splitting each word in a string by chaskins

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2022-05-19 03:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?