Not to be rude, but your friend sounds like he just discovered regular expressions last week and he's still unsure about what all the characters do, so he's trying to avoid using the tricky ones. The pipe character, like many other punctuation characters, is a special character in regex patterns, so you must escape it. For instance:
my @fields = split /,/; # split on commas
my @fields = split /\|/; # split on pipes
That's all, no big deal. However, as hbd said, unless this is a one-time task with data you're very familiar with, you should use Text::CSV and tell it that your delimiter is the pipe character. That way, when you inevitably run into data containing a quoted delimiter in one of the fields even though you were sure that would never happen, the module can handle it correctly.
Available for small or large Perl jobs; see my home node.
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 (0=?node_id=237057 ;; 1=Where should I post X? ;; 2=) 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 (0=?node_id=29281 ;; 1=Perl Monks Approved HTML tags ;; 2=):
- (0=?node_id=341118 ;; 1=How do I compose an effective node title? ;; 2=)
- (0=?node_id=174051 ;; 1=How do I post a question effectively? ;; 2=)
- (0=?node_id=674668 ;; 1=Markup in the Monastery ;; 2=)
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! (0=?node_id=43037 ;; 1=What shortcuts can I use for linking to other information? ;; 2=)
See (0=?node_id=17558 ;; 1=Writeup Formatting Tips ;; 2=) and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||