in reply to getting unique AOH from nonunique AOH ... or hash if it is better approach

You can use hash to get unique values like this. And as suggested by MidLifeXis use array ref per each entry.
#!/usr/bin/perl -w use strict; use Data::Dumper qw(Dumper); my (@logins); my %foo=(); my $fn = 'logins.txt'; open(my $fh, '<', $fn) or die "Could not open file '$fn' $!"; while (my $line = <$fh> ) { chomp($line); $foo{$line} = [ split /,/, $line ]; } @logins = values(%foo); print Dumper @logins; print $logins[0][0]; exit;
  • Comment on Re: getting unique AOH from nonunique AOH ... or hash if it is better approach
  • Download Code

Replies are listed 'Best First'.
Re^2: getting unique AOH from nonunique AOH ... or hash if it is better approach
by hiyall (Acolyte) on Feb 05, 2015 at 14:24 UTC

    Totally awesome! Thank you ... now on to study array refs