Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Fellow monks;

by JaWi (Hermit)
on Aug 27, 2002 at 09:23 UTC ( #193108=note: print w/replies, xml ) Need Help??

in reply to scrambling keys of a hash (was: Fellow monks;)

What exactly do you mean by ``scrambling'': randomizing it, or encrypting it so nobody can pear into its contents?

In the first case you probably want to have a look at Data::Random, which you can use like this snippet:

#!/usr/bin/perl -w use strict; use Data::Random qw(:all); use Data::Dumper; my @keys = qw(aap noot mies bert ernie klaas tentamen college); print "Before:\n" . Dumper( @keys ) . "\n"; my @random_set = rand_set( set => \@keys, size => $#keys + 1 ); print "After:\n" . Dumper( @random_set ) . "\n";

For encryption you can use various ways Crypt::Des for example.

Good Luck!

Changed the name of refered module to the correct one & added size operand to `rand_set' to get complete input set back (in random order)

-- JaWi

"A chicken is an egg's way of producing more eggs."

Replies are listed 'Best First'.
Re: Re: Fellow monks;
by Sihal (Pilgrim) on Aug 27, 2002 at 10:37 UTC
    Wow! I didn't know about this module Data::Rand. That's exactly what I needed, thanx.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-10-07 21:45 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (30 votes). Check out past polls.