in reply to Is it safe to use join on a hash?
This suggests that you want an array of unique numbers. It would be better to use the "uniq" function of List::Util. This function preserves the original order. Note that I print colons (:) to separate array elements.
use strict; use warnings; use List::Util qw(uniq); my @nums = (17, 10, 20, 33, 30, 40, 10, 33, 40, 15, 16, 17); my @un_nums = uniq(@nums); local $" = ":"; print "@un_nums\n";
OUTPUT:
17:10:20:33:30:40:15:16
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is it safe to use join on a hash?
by syphilis (Archbishop) on Sep 07, 2020 at 04:10 UTC | |
|
Re^2: Is it safe to use join on a hash?
by AnomalousMonk (Archbishop) on Sep 07, 2020 at 02:34 UTC |