#!/usr/bin/perl use strict; use warnings; # Create a test hash. my %test; $test{$_}="$_-$_" for ('aa' .. 'zz'); # Grab N keys. my $num_keys = 5; %test = (%test)[0..$num_keys*2-1]; # Display the result for (sort keys %test) { print "$_ = $test{$_}\n"; }
In reply to Re: Delete all hash keys except for n of them
by Molt
in thread Delete all hash keys except for n of them
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |