in reply to Re: Effective way in perl
in thread Effective way in perl

Hi Graff , Thanks for the suggestions. I tried running your code inside perl script. When i execute the above code , I see only below lines in the log file. (log_std_depot) COMMAND: /usr/sbin/swlist -l depot @ sidedepot.fc.com ## FILTERS: 0909 / / AR And also $temp_log seem to be empty. The commands are not getting executed, it only outputs the above line in the logfile. Are we missing anything here.

Replies are listed 'Best First'.
Re^3: Effective way in perl
by graff (Chancellor) on Jul 16, 2009 at 17:27 UTC
    The fact that your "log_std_depot" log file is showing two slashes in a row indicates that you are not setting $i. Apart from that, if you take the command line string from that log file ("/usr/sbin/swlist -l depot @ sidedepot.fc.com") and run it manually in a shell, what happens?

    If you make changes in the command string in order to get it to work in the shell, just make sure you apply the same changes in the perl script.

      I replaced $i with 1111 and ran the perl script, still I am getting below lines in the output file. Its not actually getting executed. COMMAND: /usr/sbin/swlist -l depot @ sidedepot.fc.com ## FILTERS: 0909 / 1111 / AR However if I run the same command on command line, its working fine. I am using the below command in the command line. /usr/sbin/swlist -l depot @ sidedepot.fc.com | grep 0909 | grep 1111 | grep AR In the script, we are not using grep, could this be the reason next unless ( /$rel_string/ and /$i/ and /AR/ ) ?????
      Hi graff, The below code is not working. next unless ( /$rel_string/ and /$i/ and /AR/ ); If i give only next unless ( /$rel_string/ ), it works fine.