in reply to Re: Simple Hash Question
in thread Simple Hash Question
sub buildCommand { my ($user,$uid,$group,$home,$create,$shell)=@_; my %flag; while (1) { print qq { 1. User: $user 2. UID: $uid 3. Group: $group 4. Home Dir: $home 5. Comment: $comment 6. Shell: $shell D. Done }; print "Please Choose An Option From Above: " chomp(my $ans=<STDIN>); if ($ans == 1) { $flag{'user'} = getInput("Enter Username: "); } elsif ($ans == 2) { $flag{'uid'} = getInput("Enter UID: "); } elsif ($ans == 3) { $flag{'group'} = getInput("Enter Group: "); } elsif ($ans == 4) { $flag{'home'} = getInput("Enter Home: "); } elsif ($ans == 5) { $flag{'comment'} = getInput("Enter Comment: "); } elsif ($ans == 6) { $flag{'shell'} = getInput("Enter Shell: "); } elsif ($ans =~ /d/i && defined($user)) { last; } else { print "INVALID OPTION!\n"; } } while (($key, $value) = each(%flag)){ $flag .= "-$key $value "; } return(%flag); }
|
|---|