#!/usr/bin/perl require '/home/me/perl/myclass.pl'; print "Enter your username: "; chomp($username = ); print "Enter your password: "; system("stty -echo"); chomp($password = ); system("stty echo"); print "\n"; $bot = new Myclass $username, $password; if(!$bot->login){ print "Enter your username: "; chomp($username = ); print "Enter your password: "; system("stty -echo"); chomp($password = ); system("stty echo"); print "\n"; } my $action = { 'do' => 'do_this', 'change' => 'change_that' }; print "Menu: "; my $menu_item; while(chomp($menu_item = ) && $menu_item ne 'logout'){ if (defined $action->{$menu_item}){ my $method = $action->{$menu_item}; $bot->$method; }else{ print "I didn't understand the command.\n"; } print "Menu: "; } if($menu_item eq 'logout'){ $bot->logout; }else{ print "wtf?\n"; }