Perl Interpretation Help

Posted on 2015-02-18
Last Modified: 2015-02-19
Would someone tell me what these perl lines are doing.  There is a query called being executed.  If i execute it standalone, i get rows returned, but for some reason it seems here it comes back empty.

open(DBQ, "/var/sysadm/oracle/bin/|")
  or die("Failed to run\n!$\n");

while (<DBQ>) {
  if (/^(.+?\.arc)\s*$/) {
    $fileName = $1;
Question by:xoxomos
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 26

Accepted Solution

wilcoxon earned 500 total points
ID: 40617759
# run /var/sysadm/oracle/bin/ and pipe the output to the DBQ filehandle
open(DBQ, "/var/sysadm/oracle/bin/|")
  or die("Failed to run\n!$\n");

# loop over lines from the output referenced by DBQ
while (<DBQ>) {
  # if the line ends with .arc
  if (/^(.+?\.arc)\s*$/) {
    # then assign the line (minus any trailing whitespace) to the variable $fileName
    $fileName = $1;

Open in new window


Author Comment

ID: 40617799

The returns:

92 rows selected.
What are some possible reasons perl dies at the open or die stage
LVL 48

Expert Comment

ID: 40617875
What are some possible reasons perl dies at the open or die stage

1.  The script doesn't exist
2.  The script doesn't have execute permission
3.  The Perl script doesn't have sufficient privilege to run the script
4.  The script exits with a non-zero status.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 40617900
Never mind.  I was root then did a crontab oracle.cron and got things mucked up.
LVL 84

Expert Comment

ID: 40619791
die("Failed to run\n$!\n");
instead of
die("Failed to run\n!$\n");
may give some indication of possible reasons

Author Comment

ID: 40619988
OZO!!!!  Long time :-)

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl - Mawk 2 108
Can Oracle Client work with an Oracle 12c Database? 5 181
Perl script to parse xml file 2 142
perl script to search for files containing text 3 100
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question