Hola a todos.
Alguien sabe como generar claves aleatorias en perl de consola
lo que quiero es generar claves aleatorias con estos numeros, pero solo 10 digitos utilizando esto como base.
0 1 2 3 4 5 6 7 8 9 A B C D E F
solo hexadecimales
Gracias.
algo así
#!/usr/bin/perl
@caracteres = qw (0 1 2 3 4 5 6 7 8 9 A B C D E F);
for ($x=0;$x<=10;$x++){
$rand = int(rand( @caracteres));
$caracter_rand = $caracteres[$rand];
print "$caracter_rand\n";
}
solo que imprima 10 dígitos y solo me imprime 1
esta es mi solucion rapida
@HEX1 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
@HEX2 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
@HEX3 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
@HEX4 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
@HEX5 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
@HEX6 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
@HEX7 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
@HEX8 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
@HEX9 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
@HEX10 = qw (0 1 2 3 4 5 6 7 8 9 a b c d e f);
$RANDHEX1 = rand( @HEX1);
$PRINTHEX1 = $HEX1[$RANDHEX1];
$RANDHEX2 = rand( @HEX2);
$PRINTHEX2 = $HEX2[$RANDHEX2];
$RANDHEX3 = rand( @HEX3);
$PRINTHEX3 = $HEX3[$RANDHEX3];
$RANDHEX4 = rand( @HEX4);
$PRINTHEX4 = $HEX4[$RANDHEX4];
$RANDHEX5 = rand( @HEX5);
$PRINTHEX5 = $HEX5[$RANDHEX5];
$RANDHEX6 = rand( @HEX6);
$PRINTHEX6 = $HEX6[$RANDHEX6];
$RANDHEX7 = rand( @HEX7);
$PRINTHEX7 = $HEX7[$RANDHEX7];
$RANDHEX8 = rand( @HEX8);
$PRINTHEX8 = $HEX8[$RANDHEX8];
$RANDHEX9 = rand( @HEX9);
$PRINTHEX9 = $HEX9[$RANDHEX9];
$RANDHEX10 = rand( @HEX10);
$PRINTHEX10 = $HEX4[$RANDHEX10];
print "$PRINTHEX1 $PRINTHEX2 $PRINTHEX3 $PRINTHEX4 $PRINTHEX5 $PRINTHEX6 $PRINTHEX7 $PRINTHEX8 $PRINTHEX9 $PRINTHEX10 \n";
gracias