Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Trying to print out only unique array values-

by toolic (Bishop)
on Aug 16, 2016 at 17:22 UTC ( [id://1169835]=note: print w/replies, xml ) Need Help??


in reply to Trying to print out only unique array values-

uniq works as I expect it to. It only prints out one "c", not two:
use strict; use warnings; use List::MoreUtils qw(uniq); my @trnAccounts = qw(a b c c d); my @unique_accounts = uniq(@trnAccounts); foreach (@unique_accounts) { # print @unique_accounts, "\n"; print $_, "\n"; } __END__ a b c d

Basic debugging checklist

http://sscce.org

Replies are listed 'Best First'.
Re^2: Trying to print out only unique array values-
by rickman1 (Novice) on Aug 16, 2016 at 19:10 UTC

    Unfortunately it did not work for me. It'll work on something simple like that for me too, but I am reading in thousands of lines and well, I am sure something was off. Thanks for your help tho!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1169835]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-23 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found