Find the answer to your Linux question:
Results 1 to 3 of 3
I need only sigle vlaue but $val is giving me duplicates. How can I remove duplicates and get the single one. foreach my $rslt ('ip','host') { foreach my $val (keys ...
  1. #1
    Linux Newbie
    Join Date
    Jan 2008
    Posts
    114

    Remove duplicate values and then store in array Perl

    I need only sigle vlaue but $val is giving me duplicates. How can I remove duplicates and get the single one.


    foreach my $rslt ('ip','host') {
    foreach my $val (keys %{$ip1->{$rslt}}) {
    print "$val\n";
    }
    }
    Switched to Scripting

  2. #2
    Linux User
    Join Date
    Aug 2006
    Posts
    458
    always try the Perl documentation first
    Code:
    perldoc -q duplicate

  3. #3
    Linux Newbie
    Join Date
    Jan 2008
    Posts
    114
    thanks, I'll take care in future.
    Switched to Scripting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...