The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 06-27-2006
vaibhav vaibhav is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 10
Question Perl script strange problem

Hi All,
I have one strange problem in perl script. Bellow is the contents of the script i am trying to write:

#!/usr/local/bin/perl

my $module_list = '';
my @running_module;
my $count=0;
my $flag=0;
my $ccprojecthome=$ENV{CCPROJECTHOME};
@module_list = `cat $ccprojecthome/product/$ENV{CCPROD}/$ENV{CCPRODVER}/config/abp_$ENV{CCPRODVER}_modbo.dat | cut -f2 -d" "`;
$size = @module_list;
print "\n First element $moddule_list[0] \n";
print "\n Lenght of the array $size \n";
@running_proj_list=`cat $ccprojecthome/module/ac/v650/config/module_profile | grep -v PROJ | grep -v Base | cut -f1 -d" "`;
foreach $md (@module_list)
{
print "\n Module $md \n";
@running_proj_list=`/usr/bin/cat $ccprojecthome/module/$md/$ENV{CCPRODVER}/confing/module_profile | grep -v PROJ | grep -v
Base | cut -f1 -d" "`;
if ( $? != 0 )
{
print "Command failed \n";
exit 1;
}
}
print "\n List of projects \n";

print " @running_proj_list ";

now the problem is that when i comment the whole for loop and execute script it will run properly but with for loop it is not working and giving error
please help me to get out of this problem.