I'd suggest you use a module to call the external command, not backticks. There are several modules that give you the ability to capture and redirect a command's STDOUT and STDERR: Capture::Tiny, IPC::Run3, and IPC::Run, the latter two even allow for you to feed custom STDIN to the command. Then you won't have to deal with the additional layer of the shell and you can do everything directly in Perl. Also, shell interpolation can introduce security holes.
Another thing, which is a matter of taste: I usually don't redirect my program's STDOUT and STDERR. If I want a logfile, I open it and write to it specifically (print $logfh "whatever\n";), and if my program produces any other output I let whoever is calling my Perl script deal with it (cron, a daemon runner, the user on the terminal, etc.).
In reply to Re: How to handel sqlplus error in perl script.
by Anonymous Monk
in thread How to handel sqlplus error in perl script.
by Ankur_kuls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |