note
Athanasius
<p>When added to a regex, the <tt>x</tt> modifier tells the regex engine to ignore whitespace — that is, to omit the spaces, etc., in the regex from the pattern to be matched. So, if you are trying to match something like:</p>
<code>
<td class="countryValue">
# ^ note the space
</code>
<p>and your regex has an <tt>x</tt> modifier, you must specify the space(s) to be matched explicitly. For example:</p>
<code>
<td \s+ class="countryValue">
</code>
<p>That said, when I run your code with this fix applied:</p>
<code>
while ($content =~ m!
tr \s+ class="bgrow1">
<td>
(.*?) # $1
</td>
<td \s+ class="countryValue">
(.*?) # $2 country
</td>
<td \s+ class="destnameValue">
(.*?) # $3 destination
</td>
<td \s+ class="hotelNameValue">
(.*?) # $4
</td>
<td \s+ class="durationValue">
(.*?) # $5 trip_length
</td>
<td \s+ align="RIGHT" \s+ class="priceValue">
<a \s+ target="_blank" \s+ href="(.*?)"> # $6 url
(.*?) # $7
</a>
</td>
!gisxm)
</code>
<p>the regex still gets no matches, so there is more wrong than just the missing whitespace. (Or, there is more whitespace lurking in the target webpages than I have allowed for.) For further help from the monks, please follow the advice given above by [davido], and reduce your problem to a <i>minimal</i> code snippet demonstrating the problem and complete with representative data.</p>
<p>BTW, the variable <tt>$airport</tt> is accessed in the final <tt>print</tt> statement, but never initialized. You would have seen this if you had begun the script with</p>
<code>
use strict;
use warnings;
</code>
<p>as [Gangabass] advised in [id://991875].</p>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-968231">
<p>Athanasius <font color=#008000><°(((><</font> <i>contra mundum</i></p>
</div></div>
991737
992013