Now it's Fastolfe who's reading my mind {g}.   Just encountered "asked them all out-of-order".

So... 2 questions:
A - how do I tie my %prompts = (blah blah); ?
II - does $tied_hash{$prompts{$prompt}} = $input still need to be tied?

Here's what I've got so far:

1 #!/usr/bin/perl -w 2 # getpass.pl 3 4 use strict; 5 use Term::ReadKey; 6 use Tie::IxHash; 7 8 # Hash of on-screen prompts for old/new passwords 9 my %prompts = ( 10 'Enter old password:' => 'oldpass', 11 'Enter old enable password:' => 'oldenable', 12 'Enter new password:' => 'newpass', 13 'Confirm new password:' => 'newpassconf', 14 'Enter new enable password:' => 'newenable', 15 'Confirm new enable password:' => 'newenableconf', 16 ); 17 18 # Walk through each on-screen prompt to populate new Hash of passwo +rds 19 print "Prompting for passwords (*won't* appear on-screen)\n\n" 20 my %passwds; 21 for my $prompt (keys %prompts) { 22 print " $prompt " 23 ReadMode('noecho'); 24 chomp(my $input = <STDIN>); 25 $passwds{$prompts{$prompt}} = $input; 26 ReadMode(0); 27 print "\n" 28 }

In case I haven't already mentioned it, y'all's help is truly appreciated.   Double, no, make that triple++.
    cheers,
    Don
    striving for Perl Adept


In reply to RE: (3) Scalars as hash keys? (tie %prompts) by ybiC
in thread Scalars as hash keys? by ybiC

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.