Iterate over the array, and attempt to extract user information from each element. If successful, add the user to the hash.
(Not tested.)use Tie::File; tie my @file_array, 'Tie::File', $filename foreach (@file_array) { if (/^([^:]+)(?::[^:]*){6}:([^:+]+):/) { # this regexp can pro +bably be improved. $users{$1} = $2; # you can add a debug print here if you want. } } untie @file_array;
In reply to Re: Pattern Matching Question
by gaal
in thread Pattern Matching Question
by gsr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |