jreyesb has asked for the wisdom of the Perl Monks concerning the following question:

Hi again, this site is awesome, thank you... Well i have this
#!/usr/bin/perl use strict; InsertRecords("file.parsed"); sub InsertRecords { my $ctrl = "$DIRBIN/main.ctl"; my $data = shift; my $log = "$DIRLOG/sqlloader.log"; my $logbad = "$DIRLOG/sqlloader.bad"; system("$ORACLE_HOME/bin/sqlldr control=$ctrl data=$data userid=user +/pwd\@dbname log=$log bad=$logbad"); }
And it works perfect but I do not like the messages produced to the screen by the sqlldr program like this:
SQL*Loader: Release 9.2.0.8.0 - Production on Mon Jul 13 19:16:46 2009 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Commit point reached - logical record count 64 Commit point reached - logical record count 78
How can i avoid this, in fact, I would like to record these messages in a log, light please!!! Thank you

Replies are listed 'Best First'.
Re: Using sqlldr with perl
by toolic (Bishop) on Jul 14, 2009 at 23:55 UTC
    The documentation for system has a link to qx, which can be used for capturing output. Read Quote Like Operators, which shows various possibilities for capturing STDOUT and/or STDERR.
      to suppress the sqlldr messages on screen, you can use 'silent=all'
Re: Using sqlldr with perl
by elTriberium (Friar) on Jul 15, 2009 at 00:37 UTC
    If you want these messages in a logfile you can also redirect the output of the system command to a file:
    system("... >& logfile.log");