Please help, my brain is fried

Shay Harding mekla at
Wed Jan 26 20:04:17 CST 2000

Hello all,

Sorry I missed the last X meetings (not even sure how many any more). I do keep
up with them here though.

OK, I have the code below, and can't figure out why it is misbehaving and I am
figuring it is something simple but due to working 80+ hours a week, I can't
see it. This is really not part of any program, just something I was messing
with. It basically creates a variable length string (6-12 alphanumeric
characters), except the string returned is not alphanumeric.


  my $count = 0;
  print "\n\n", create_login_id(), "\n";

  sub create_login_id(){
      my $temp = '';

      my $length = int(rand(6))+6;

      for (my $x = 1; $x <= $length; $x++){
          my $t = get_char();
          $temp .= chr($t)."($t)";

      return $temp;

  sub get_char(){

      my $char = int(rand(57))+65;
      print $count, "  ", chr($char), "\n";

      get_char() if ($char >= 91 && $char <= 96);
      return $char;

Sample output is:

This is the loops through the routine 'get_char'

1  C
2  p
3  p
4  ]
5  W
6  [
7  M
8  x
9  b

Here when it hits loop 4 it should do another loop since I exclude ASCII 93,
and it does this except below as you can see it keeps ASCII 93 and doesn't use
loop 5 value which would be valid. Using the 'my' scoping the number 4 value
should go out of scope on the recursive call or am I missing something here?




More information about the Phoenix-pm mailing list