ocehb: (Default)
[personal profile] ocehb
(keys %hash)[int rand scalar %hash]
(values %hash)[int rand scalar %hash]

# for i in {0..9}; do
perl -le '%hash = ( aa => 1, bb => 2, cc => 3, dd => 4 ); print ((keys %hash)[int rand scalar %hash])';
done
cc
bb
bb
dd
bb
aa
dd
dd
aa
aa
#

Date: 2012-07-31 08:59 pm (UTC)
From: [identity profile] jerom.livejournal.com
buggy. Попробуй с хэшом:

%hash = (
name => 'John Doe',
age => 39,
phone => '555-1212',
city => 'Chicago'
);

PS: А int зачем?

Profile

ocehb: (Default)
ocehb

January 2021

S M T W T F S
     12
345 6789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 10th, 2026 06:29 pm
Powered by Dreamwidth Studios