Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Fellow monks;

by JaWi (Hermit)
on Aug 27, 2002 at 09:23 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-24 16:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found