note
bart
There are a few things wrong with your approach.
<ol>
<li>You return the hash when you match a line for a single user
<blockquote>Instead, put the <c>return</c> statement at the end of the sub.</blockquote>
<li>You replace the contents of the hash for each user
<blockquote>Instead, add a single entry in the hash for each user doing this:
<c>
$UID_PATH{$USER} = $UID[5];
</c>
</blockquote>
</ol>
<p>For optimization you could decide to return the hash ref, <c>\%UID_PATH</c> instead of a flattened list, but then you'd have to fix the script to use a hashref instead ofa hash, everywhere. (In languages like PHP and Javascript, there is no difference between a hash ref (or a hash. (AKA "associative array" in PHP and "object" in Javascript)
1039936
1039936