in reply to Re[3]: Modifying STDOUT and keeping control
in thread Modifying STDOUT and keeping control
I want the command to run with my modified output so the user can't see that it is telnetting to 192.168.1.1.#!/usr/bin/perl -w use strict; # Example script, simmilar to the one I'm writing.. menu(); sub menu { my @menu = ( [ 1 => 'Go' ], ); my %call = ( 1 => \&go, ); system("clear"); print " ", "$_->[0]. $_->[1]\n" for @menu; print "Enter Selection:"; chomp( my $answ = <STDIN> ); my $sub = $call{$answ} or err(); $sub->(); } sub go { # This is where the telnet call gets made. system("telnet", "192.168.1.1"); # Currently spawns shell command # my $var = `telnet 192.168.1.1' # This will save output to $var # So I can edit the output. system("clear"); menu(); } sub err { print "Valid Selection Not Entered!\n"; menu(); }
The output can be modified easily enough using s/192.16.1.1//, But I can't seem to figure out how to make the user see the output I desire, while it's executing the telnet command.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re[3]: Modifying STDOUT and keeping control
by fruiture (Curate) on Oct 14, 2002 at 21:54 UTC |