Various means of getting symbol characters (non-alphanumerics such as !) into an array for random password generation.
# the manual way, hunting over the keyboard, and worrying about # possibly escaping certain specials (truncated example) @s = qw(! @ # $ % ^ & *); # investigation of the ASCII table shows the special characters are # in chunks, which we can convert into the real characters using map @s = map { chr } 33..47,58..64,91..96,123..126; # this can also be done without knowing where the special characters # are with a grep for printable non-alphanumeric non-whitespace chars @s = grep { /[[:print:]]/ and /[^a-zA-Z0-9\s]/ } map { chr } 1..128;

Replies are listed 'Best First'.
Re: Symbol characters for passwords
by dakkar (Hermit) on Dec 23, 2002 at 10:14 UTC

    To generate new root passwords, we did:

    #!/usr/bin/perl -w use MIME::Base64; open RND,'<','/dev/urandom'; sysread RND,$rnd,1024; close RND; print encode_base64($rnd);

    And then we hunted into the result for something we would be able to remember.

    Note: this supposes you are on a system that has /dev/urandom. Substitute it with any reasonable random-stream generator.

    -- 
            dakkar - Mobilis in mobile