COURSE of the MONTH

SH & PERL, Easy newbie question

I've got a perl script that does things (not important what). ie. the file starts with:
#!/bin/perl
I want that same script to run a programs (lets say ls and uptime, for eg.), which I can make happen using first line:
#!/bin/sh

What you want to do is quite right - if you wish to make a script that uses shell commands, specify the first line as invoking the appropriate shell.
Are you saying that

#!/bin/sh
ls

for example, does not work for you? What is happening? Presumably you are calling this as a CGI script - so maybe you need to check that the directory the script is in is defined as a cgi-bin directory in the Webserver, that any required file extensions (e.g. .cgi) are being used, that the script has execute permissions, that the script can be run successfully as the user who the Web server runs as, and so forth.

0

TManAuthor Commented: 1998-11-26

davidmwilliams:
Yes that works.. but I need to use PERL commands (open, foreach, while, etc...) in that same script.
So would the better question be :
Can I execute shell commands within PERL script ?