Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to perl

Status
Not open for further replies.

CIMTEET

Programmer
Jun 25, 2001
182
US
Can perl use a cursor to access oracle databases on unix systems?
I need to learn how to do two things quickly with perl:

1.Read an external text file
2.Parse and pass data to another file

Are there any examples I could work with?

Greg
 
Hello,

I am not sure if you are able to use an oracle database however I know that you can read and use information stored on an external file... For example

To open and write to a file (i.e. logfile.txt)...

open (LOG, ">>/YOURPATH/logfile2.txt") || Error('open', 'file');
flock (LOG, 2) || Error('lock', 'file');
print LOG " Hello\n";
close (LOG);

Then to use what is written in the file (using variable @logmessages)...

open (LOG, "/YOURPATH/logfile.txt") || Error('open', 'file');
flock (LOG, 2) || Error('lock', 'file');
my @logmessages = <LOG>;
close (LOG) || Error ('close', 'file');

Now whereever you place @logmessages, the logfile will be printed (in this case the word "hello".

Chris

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top