Open standard input, as a file, for reading.  Open standard output for
writing.  It's possible perl may have automatically done some or all of
this... I'm NOT a perl expert by any means.  

There's a function that gets a line from a file.  Use that function on
your new filehandle.  That pauses, waiting for a line to be complete...
ie, the user hits enter.  (or control-D, the Unix EOF character).  

Process that line.  Print results to standard output.  

Repeat if necessary. 

In BASIC, you had:

INPUT "Give me a value",A$

I can't give you the exact perl syntax because I don't use it much, but
you do it in two steps: 

Print "Give me a value" to standard output;
Get a line from standard input.

This is actually an extremely powerful way to think about the problem,
as is nearly always the case in Unix.  This means that you can run your
program just as easily from a file as from a user.  Script up some test
cases, dump them in a file, and redirect from that file to standard
input.   Your program neither knows nor cares that it's actually
talking to a file, to a network socket, or to another program.  It's
just input.

Many of the conventions will seem very strange, coming from
microcomputer languages, but there's good reasons for most things.  

Perl is a rather ugly language; I don't care for it much.  If you're
trying to learn enough to work on SlimServer, you're stuck with it, but
if you just want general Unix scripting, many people prefer Python.   Or
you can just use bash... the shell itself has a very powerful, albeit
somewhat arcane, script language.  

You might look through the O'Reilly books.  Remember that when you
learned BASIC and FORTRAN, you probably bought books to do it.  
Documentation, sadly, must often be paid for, even when the program
itself is free.


-- 
Malor
------------------------------------------------------------------------
Malor's Profile: http://forums.slimdevices.com/member.php?userid=1961
View this thread: http://forums.slimdevices.com/showthread.php?t=20518

_______________________________________________
Discuss mailing list
Discuss@lists.slimdevices.com
http://lists.slimdevices.com/lists/listinfo/discuss

Reply via email to