Hi guys,

I am starting to learn Perl as the ksh scripting language (which I
don't know either) looks less than powerful.

I have used C many years ago, and write my stuff in REXX on a
mainframe, so Perl looks like the best of both worlds.

My environment is AIX 5.3 running some sort of 5.8 PERL. Oh hell, let
me check..... 5.8.2.

Most of the documentation and tutorials I find are for version 5.10 so
I am running into the stuff in the manuals and tutorials that do not exist 
in 5.8.

As a starting project to learn the language, I want to execute an AIX
command and be able to read the output of the command in the script.

EXEC doesn't work, because the program ends at the EXEC statement.

SYSTEM does not appear to be available at the 5.8.2 level.

I tried what usually works in other scripting languages of just
putting the command in quotes. Putting "ls" in the script actually
executes the command, and sends the output to the terminal. I want the
output in a file, so I tried "ls > out" and I get an error (shown
below).

I also tried to OPEN, PRINT then CLOSE a file, but the OPEN appears to
fail as if the function is not recignized, and no form of the OPEN
statement seems to work. I have included the script and results below.

This seems like it should be simple, but something escapes me.

Thanks,
Neal

Script:

#/usr/bin/env perl -w
        "ls > out";
print "RC = $?";
open OUTFILE, '< out' or die 'problem';
print while <OUTFILE>;
close (OUTFILE);


Results:

test.pl[2]: ls > out:  not found.
RC = 127
test.pl[4]: open:  not found.
test.pl[5]: 0403-057 Syntax error at line 6 : `;' is not expected.

-- 
Neal

Elected officials should wear uniforms like 
NASCAR drivers. That way it would be easier 
to identify their corporate sponsors.

Reply via email to