Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is half a question and perhaps half an answer (the question's in here as I am not yet allowed to write comments...). Okay, here we go:</p> <blockquote> <p>Name servers:<br> ns.mistral.co.uk 195.184.229.229</p> </blockquote> <p>Is this what an entry in the file you're parsing looks like? What will follow immediately afterwards - more domain names and IP addresses? And will there be blank lines in between?</p> <p>Anyway, I think your problem may (in part?) be related to your reading the file line by line. Once you get to the IP address line, the info about 'Name servers:' having been present will be gone. Multiline matching will not help if you're looking at your file line by line. Thus I'd recommend switching to paragraph mode:</p> <pre><code>{ local $/ = ''; # one paragraph instead of one line constitutes a record while ($record = &lt;DOMAINS&gt;) { # $record will now contain all consecutive lines that were NOT separated # by blank lines; once there are &gt;= 1 blank lines $record will have a # new value # do stuff, e.g. pattern matching } } </code></pre> <p>But then you said</p> <blockquote> I have tried an example of Stackoverflow where &lt;DOMAINS&gt;; will take the next line but this didn't work for me and I assume it is because we have already read the contents of this into $domaininfo. </blockquote> <p>so maybe you've already tried what I have just suggested? An alternative would be to just add another variable ($indicator or whatever) which you'll set to 1 once 'Name servers:' has been read, and as long as it's equal to 1 all following lines will be treated as containing the data you need. Whether this is feasible, however, depends on you always knowing what else your data file contains.</p> <p>I hope something in here has been helpful to you. If there are any questions, please ask :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload