Operating System - HP-UX
1832864 Members
2812 Online
110048 Solutions
New Discussion

Perl is very difficult to use !

 
cpchan
Occasional Advisor

Perl is very difficult to use !

Dear all,

I need to write a crontab script in my HP-UX system in order to do SAP re-index regularly :

#!/opt/perl/bin/perl
#
# Use SAP BR*TOOLS to reorganize indexes in SAP database
#


/oracle/DEV/920_64/bin/sqlplus sapdev/xxx \@/oracle/DEV/genrebidx2.sql

Case 1
$cmd="ORACLE_HOME=/oracle/DEV/920_64";
$result=system($cmd);

Error 6 initializing SQL*Plus
Message file sp1.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

Case 2
export ORACLE_HOME=/oracle/DEV/920_64;

Bareword found where operator expected at /oracle/DEV/idx_rebuild.sh line 7, near "/oracle/DEV"
(Missing operator before DEV?)
syntax error at /oracle/DEV/idx_rebuild.sh line 7, near "/oracle/DEV"
Execution of /oracle/DEV/idx_rebuild.sh aborted due to compilation errors.

Case 3
export ORACLE_HOME="/oracle/DEV/920_64";

Can't locate object method "export" via package "ORACLE_HOME" (perhaps you forgot to load "ORACLE_HOME"?) at /oracle/DEV/idx_rebuild.sh line 7.

Any ideals ?
4 REPLIES 4
Torsten.
Acclaimed Contributor

Re: Perl is very difficult to use !

I would suggest to follow your other thread:

http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1263116

Useful hints are already there (e.g. source a file ...)

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
dirk dierickx
Honored Contributor

Re: Perl is very difficult to use !

perhaps this problem is best solved using simple sheel scripting? seems like all you are doing is calling shell commands anyway (which don't work, as expected).

use perl if you need to shift/sort/transform/distilate/etc. data from huge logfile/cmd output/etc.
James R. Ferguson
Acclaimed Contributor

Re: Perl is very difficult to use !

Hi:

Perl will become very helpful if/when you add the 'strict' and 'warnings' pragmas to your Perl scripts!

#!/opt/perl/bin/perl
use strict;
use warnings;

So many trivial errors are caught this way...

As Torsten said, you need to revisit your original thread, of which this is really just a continuation! The verb 'export' as the shell uses it doesn't apply to Perl. The 'ENV' hash is where environmental variables are stored and imported.

In UNIX, a child process alter its environment but it cannot alter its parent's environment.

It benefits everyone (!) if you do not open new threads for the same question. You should also read:

http://forums12.itrc.hp.com/service/forums/helptips.do?#28

Regards!

...JRF...
Regards!

...JRF...

cpchan
Occasional Advisor

Re: Perl is very difficult to use !

Thanks.
I already fixed the problem by myself, used $ENV.