in reply to HASH Hierarchy

What you have there is fine. Although, if you don't need it for anything else, you can eliminate @hierarchy and shorten the code a bit. Don't forget warnings too.

#!/usr/bin/env perl use strict; use warnings; my $order = 0; my %hierarchy; $hierarchy{$_} = $order++ for @ARGV; while( my( $key, $value ) = each %hierarchy ){ print "$key: $value\n"; }

Replies are listed 'Best First'.
Re^2: HASH Hierarchy
by dirtdog (Monk) on Feb 16, 2018 at 16:10 UTC

    much more elegant...thank you!