Author: Not specified | Language: perl |
Description: Not specified | Timestamp: 2017-09-23 18:25:40 +0000 |
View raw paste | Reply |
- my %hosts;
- Menu();
- sub Menu{
- my $choice;
- print "Choose an option:\n1-Add a host\n2-Search a host\n3-Delete a host\n4-Edit a host\n5-Show all hosts\n6-Exit\n";
- $choice = <>;
- if($choice == 1){
- Add();
- }
- elsif($choice == 2){
- my $sc = <>;
- Search($sc);
- }
- elsif($choice == 3){
- my $dc = <>;
- Delete($dc);
- }
- elsif($choice == 4){
- my $ec = <>;
- Edit($ec);
- }
- elsif($choice == 5){
- ShowAll();
- }
- elsif($choice == 6){
- Exit();
- }
- else{
- Menu();
- }
- }
- sub Add{
- my $name = <>;
- my $ip = <>;
- $hosts{$name} = $ip;
- Menu();
- }
- sub Search{
- my $srch = $_[0];
- }
- else{
- }
- Menu();
- }
- sub Delete{
- my $del = $_[0];
- }
- else{
- }
- Menu();
- }
- sub Edit{
- my $edit = $_[0];
- my $editname = <>;
- my $editip = <>;
- $hosts{$editname} = $editip;
- }
- else{
- }
- Menu();
- }
- sub ShowAll{
- my $size = @names;
- my $aux;
- for( $aux = 0; $aux < $size; $aux = $aux + 1 ){
- }
- Menu();
- }
- sub Exit{
- }
View raw paste | Reply |