note
BrowserUk
<p>Weird! The ^Ms that are getting left behind on the end of the first names suggests that the contents of the data file is weird, though given the source that's no real surprise.
<p>The reason for having the <code>no warnings 'uninitialized'</code> is to avoid the need for a special case to deal with location lines that don't contain the room number. The regex is saying:
<code>
m[
([^/]+) / # capture the phone number before the slash
(?: #optionally capture the room number if it is exists
(\S+) # capture all the non-spaces between the /
\s+ #and one or more spaces
)? # but only if there are two sets of non-spaces
# separated by a one or more spaces before EOL
(\S+) #capture the building code.
$
]x;
</code>
<p>If the room number isn't present, the second capture ($2) will be undefined, hence the need to suppress the warning. However, that you are getting three warnings means that all 3 captures are undefined (ie. the regex failed to match), which suggests that the data in the file is formatted somewhat differently to the sample data you posted.
<p>Without being able to see the actual contents of the file it is a little difficult to diagnose the problem.
<p>Perhaps you could run this one liner on the data file to dump the first few lines in hex and post the output here?
<code>
perl -nle" exit if $. == 15; print unpack 'H*', $_" testdata.txt
</code>
<div class="pmsig">
<div class="pmsig-171588">
<hr />
<font size=1 >
<div>Examine what is said, not who speaks.</div>
"Efficiency is intelligent laziness." -David Dunham<br />
"Think for yourself!" - [Abigail-II|Abigail] <br />
</font>
</div>
</div>
351465
351583