Operating System - Microsoft
Showing results for 
Search instead for 
Did you mean: 

Examples of ActivePerl code

Go to solution
Regular Advisor

Examples of ActivePerl code


I am new to Perl but need to write a script that sends alerts back to OVO (OpenView Operations). The script will run on Win2K, XP and 2003.

The script would need to do the following:

1. Check if a particular configuration file exists on the system where it is run. If the file does not exist, execute an OVO command and exit with value 1. Therefore, need some examples of how to check if a file exists.

2. If the configuration file exists, start reading it. Each line of the configuration file will have two columns (separated by one space). The first colume will contain text in quotes (e.g. "test1" or "This is a test"). The second column will contain numbers (e.g. 1, 3, etc). So, the cofig file will look something like this:

"test" 2
"This is a test" 3
...and so on

Therefore, need some examples of reading a file and assigning contents to variable.

3. When each line is read, assign the value in the first column to variable #1, and the value on the second column to variable #2. Therefore, need examples of how to assign values read to variables.

4. The script needs to execute some OVO utilities and act on variable #1 and #2. Therefore, need some examples of calling other .exe programs from Perl scripts.

5. Compare a variable's value to a numeric value.

Can you please provide some examples of code snippets that would do the above 5?

Thanks so much and sorry for the long description.
H.Merijn Brand (procura
Honored Contributor

Re: Examples of ActivePerl code


Enjoy, Have FUN! H.Merijn [ who thinks this belongs in the windows section ]
Enjoy, Have FUN! H.Merijn