For those that don't know, this is a repeat of
substring function. See that thread for related discussion.
And I think my last comment there, RE: RE: Re: substring function, answered it (as far as his need to use substr goes). If that did not help you, please respond and explain why and perhaps we can come up with a slightly different approach. I never saw a reply to my post so I assumed you had gotten it working.
I still think you're doing something weird here. It's not natural to have binary ^M's in ASCII data like that unless you goofed up the ASCII transfer and/or don't understand how newlines work or how to work with ASCII data on multiple platforms. This is very fishy, but if you want to insist on keeping us in the dark, I hope this solution helps you. I don't think this is the root of your problem, though. That's why I don't like solving it under these constraints.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.