Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Is it safe to use join on a hash?

by choroba (Cardinal)
on Sep 06, 2020 at 22:53 UTC ( [id://11121424]=note: print w/replies, xml ) Need Help??


in reply to Is it safe to use join on a hash?

Using join on a hash would be kind of strange, but using it on the keys of a hash is quite common. Join has no side effects (it stringifies the elements, which might change the internal representation of the values if they are numbers, but from Perl perspective, they don't change; moreover, hash keys are always strings, anyway).

To give predictable output, you might want to sort the keys before joining them:

my $unique_nums = join ' ', sort keys %unordered;

Update: See davido's post.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-26 03:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found