in reply to Extracting a list of keys from a multi-dimensional hash.
and the results are:#!/usr/bin/perl use warnings; use strict; my %ManagerInCharge = ( 200610 => { 1 => "jane", 2 => "john", 3 => "joe", 4 => "frank", }, 200701 => { 1 => "gunder", 2 => "abel", 3 => "frank", }, ); my $month = "200701"; # # If you need the keys assigned, then the statement # my @slice = keys %{$ManagerInCharge{$month}} # is enough. # my @slice = map { $ManagerInCharge{$month}{$_} } ( keys %{$ManagerInCharge{$month}} ); for (@slice) { print "value is $_\n"; }
C:\Code>perl assign_slice.pl value is gunder value is frank value is abel
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting a list of keys from a multi-dimensional hash.
by Anonymous Monk on Jan 16, 2008 at 19:15 UTC |