Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
... This should be darn simple, but I can't make it work. It's quite a simple concept: make the record separator ";\n" and filter-out all lines that start with a # -- comments.

First off: Are you sure the current record selector is '\n'. If this is running on a windows machine it is '\r\n' (or do I mean '\n\r'? who cares). In any case the safe way to get the new descriptor is to do (with local if required)

$/= ';'.$/
But actually I think you shoud be not monkeying with $/: at all and just skipping over # lines as you read them in, i.e.
while (my $line = <DATA> ){ next if ($line =~ s/^#/); # skip comment lines print "Query: $line\n"; }

Dingus


Enter any 47-digit prime number to continue.

In reply to Re: Record Separator affecting Regex by dingus
in thread Record Separator affecting Regex by Kozz

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 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?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-04-24 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found