It looks to me like $sqlinfo is the result of a database query, probably of the $sth->selectall_arrayref variety, and that those results contain multiple rows for some users. Would it not be simpler to modify the SQL query to obtain one row per user?
I'm really reaching here, but assuming a well-normalized database the SQL query probably joins three tables, something like:
select p.number, p.user, p.first, p.lastn, t.tel, e.email
from people p
left join telephone t on t.number = p.number
left join email e on e.number = p.number
If this is the case, you're getting multiple rows for users with multiple telephone numbers and/or email addresses.
Changing the SQL query to get distinct users would require some way to select only one each tel and email.
If I'm guessing correctly, and changing the query is feasable, I'd need the database type (Oracle, MSSQL, MySQL, etc.) and the table schemas to work out a suitable WHERE clause.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.