CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
[HELP] Perl script waiting for Key Input and sending URL until quit

 



SteffenBaier
Novice

Oct 26, 2011, 7:47 AM

Post #1 of 3 (447 views)
[HELP] Perl script waiting for Key Input and sending URL until quit Can't Post

Hi Guys,

I am trying to figure out how create a perl script that I can start with an argument (IP Address or Host Name) that then loops itself waiting for a Key Press.

An example would be vu [enter] and the vu would be part of a URL together with the 1st Argument.

vu for Volume up would point to a fixed string of VolumeUp.

vd for Volume down would point to a fixed string of VolumeDown.

I would define multiple of these.

The combined String would then be send from the Perl script as:

http:\\hostame or ip\VolumeUp

This should loop until a user's quits the script.

Are there any quick and dirty examples out there?

THX

Steff


SteffenBaier
Novice

Oct 31, 2011, 6:51 AM

Post #2 of 3 (428 views)
Re: [SteffenBaier] [HELP] Perl script waiting for Key Input and sending URL until quit [In reply to] Can't Post

OK,

I found some starting Point


Code
print "Please enter Command? ";		# Ask for input 
$a = <STDIN>; # Get input
chop $a; # Remove the newline at end


So how would I now match $a / the input from STDIN against for example:


Code
$Vu="Key:VolUp"; 
$Vd="Key:VolDown";


Anyone ?

THX


FishMonger
Veteran / Moderator

Oct 31, 2011, 7:46 AM

Post #3 of 3 (423 views)
Re: [SteffenBaier] [HELP] Perl script waiting for Key Input and sending URL until quit [In reply to] Can't Post

Use a dispatch table.

http://en.wikipedia.org/wiki/Dispatch_table

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives