in reply to Scalars as hash keys?

What is $key? You aren't defining it anywhere. You've declared it via 'use vars', but you haven't set it anywhere. Do you mean to use $prompt here?

Replies are listed 'Best First'.
RE: (2) Scalars as hash keys?
by ybiC (Prior) on Oct 26, 2000 at 22:50 UTC
    Hmmm... I see what you mean.

    I meant it to be the value of the password scalar in the above hash (at line 21) as entered from keyboard.   Should it push <STDIN> into each scalar?

    I'm not at all familiar with what I'm trying to do here, so pointers to relevent docs are quite welcome.
        cheers,
        Don
        striving for Perl Adept

      Looking at your code, it seems like you want to be trying your hash values as the variable for your resulting hash. Your variable names aren't consistent, but I believe you want something like this:
      chomp($prompt{$passwds{$prompt}} = <STDIN>);
      That would set up your resulting %prompt hash like this:
      %prompt = ( '$oldpass' = 'whatever I typed for old password', '$oldenable' = 'whatever I typed for old enable, ... );
      Note the presence of the dollar signs in the hash keys, which is weird. You probably want to take them out unless for whatever reason you want your hash keys to all be prefixed with dollar signs.. *shrug*..

      You also probably want to use a new name for your resulting hash, like, %new or %input. And use strict;! You're doing good by keeping track of variables via 'use vars', but you aren't running with strict turned on, which would have told you that %prompt was being used undeclared, and might have pointed you in the direction of this problem.

        /me is stupid today - forgetting to use strict.   8^(

        Many thanks, Fastolfe.   I kinda follow you, but don't fully grok implementation of your fixes.   Will run w/the ball and see how far I get.
            cheers,
            Don
            striving for Perl Adept