I took yours now:
#!/usr/bin/perl use strict; use warnings; print mkpasswd({ minlen => 8, maxlen => 10, lower => 1, special => 1, upper => 1, digit => 1, }); sub mkpasswd { my($param)= @_; if( not ref $param ) { $param= { minlen => $param, maxlen => $param, }; } if( ref $param eq 'HASH' ) { $param->{minlen}||= 8; $param->{maxlen}||= $param->{minlen} + 2; } my ( @l, @u, @n, @s, @p); open( URANDOM, "</dev/urandom" ) || die $!; read( URANDOM, $_, 4 ); close URANDOM; srand( unpack( "L", $_ ) ); @l = ( "a" .. "z" ); @u = ( "A" .. "Z" ); @n = ( 0 .. 9 ); @s = ( '#', ',', ' ', qw# ! " $ % & ' ( ) * + - . / : ; < = > ? @ [ \ ] ^ _ ` { | } + ~ # ); push( @p, $l[rand(@l)] ) for ( 1 .. $param->{lower} ); push( @p, $u[rand(@u)] ) for ( 1 .. $param->{upper} ); push( @p, $n[rand(@n)] ) for ( 1 .. $param->{digit} ); push( @p, $s[rand(@s)] ) for ( 1 .. $param->{special} ); my $m = $param->{minlen} - @p; $m=0 if $m<0; my $x = $param->{maxlen} - @p - $m + 1; $x=0 if $x<0; my(@j)= ( @l, @u, @s, @n ); $x= $m + rand($x); push( @p, $j[rand(@j)] ) for ( 1 .. $x ); for ( my $i = @p ; --$i ; ) { my $j = int( rand( $i + 1 ) ); next if $i == $j; @p[ $i, $j ] = @p[ $j, $i ]; } return join( "", @p ); }

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

In reply to Re^2: String::MkPasswd still supported? by Skeeve
in thread String::MkPasswd still supported? by Skeeve

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.