Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Input record separator

by Zaxo (Archbishop)
on Mar 18, 2005 at 10:01 UTC ( [id://440654]=note: print w/replies, xml ) Need Help??


in reply to Input record separator

Your wish won't work, because the input record seperator cannot be treated as a regular expression.

You have a pretty common situation, where records are marked by a prefix instead of a postfix seperator. I think the easiest way to deal with that is to set local $/ to "\n>" and take the first record as a special case. Call chomp to remove the "\n>" from the end of the records.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Input record separator
by travisbickle34 (Beadle) on Mar 18, 2005 at 10:31 UTC
    Thanks a lot guys - both very valid and helpful suggestions.
    Being a newbie, I was under the miconception that chomp ONLY removed newlines.
      No, chomp removes whatever currently is in $/, or what it matches (= multiple newlines) in the only case that actually acts like a regexp: paragraph mode.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://440654]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-28 15:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found