But it doesn't work.
Looks like keyboard-entered passwords aren't getting pushed(?) into the scalars.
Multiple "uninitialized value" errors result for each of lines 8, 21, 26.
Would any clueful Monks care to enlighten me on whatever fundamental concept/syntax I'm lacking?
cheers,
Don
striving for Perl Adept
1 #!/usr/bin/perl -w 2 # getpass.pl 3 4 use Term::ReadKey; 5 use Tie::IxHash; 6 use vars qw($key $t %passwds); 7 8 $t = tie(%passwds, Tie::IxHash, 9 'Enter old password:' => "$oldpass", 10 'Enter old enable password:' => "$oldenable", 11 'Enter new password:' => "$newpass", 12 'Confirm new password:' => "$newpassConf", 13 'Enter new enable password:' => "$newenable", 14 'Confirm new enable password:' => "$newenableConf", 15 ); 16 17 print "Prompting for passwords (won't appear on-screen)\n"; 18 foreach $prompt (keys (%passwds)) { 19 print "$prompt "; 20 ReadMode('noecho'); 21 chomp($prompt{$key} = <STDIN>); 22 ReadMode(0); 23 print "\n" 24 } 25 26 unless (("$newpass" eq "$newpassConf") and ("$newenable" eq "$ne +wenableConf")) 27 {die "\nNew password(s) confirmation didn't match. Tough be +ans. Try again.\n"}
In reply to Scalars as hash keys? by ybiC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |