On Tue 19 Mar, Richard Torrens (RiscOS) wrote: > > How does one pass a command from Perl to the CLI?
There Is More Than One Way To Do It, in fact I can think of around six depending on exactly what you want to do. You would probably think of the system() command as being most similar to Basic's OSCLI(). Example: system("command arg1 arg2") and die $!; Of course OSCLI() will behave more like Perl's exec() in some situations and that may or may not be what you want. Both system() and exec() can be called in two different ways depending on whether you want to use the shell (although I doubt that they do anything different in the RISC OS version because all tasks have to be started with a command line). I'll leave you to look up the fine details in your favourite source of documentation. Finally, you may wish to capture the output of a command and there are several ways of doing that too. You could just say: $output = `command arg1 arg2`; $output = qx(command arg1 arg2); # Same thing Or you can use the open() command to open a file handle to the input or output of the external program. There are also modules called IPC::Open2 and IPC::Open3 that allow you to both read and write to a program the same time. Again, I think I should leave you to check the docs for the gory details. So many choices! Isn't Perl fun?! -- James Taylor <[EMAIL PROTECTED]> Based in Southam, Cheltenham, UK. PGP key available ID: 3FBE1BF9 Fingerprint: F19D803624ED6FE8 370045159F66FD02