Perl script strange problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl script strange problem
# 1  
Old 06-27-2006
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 Smilie
please help me to get out of this problem.
# 2  
Old 06-27-2006
What's the error?
# 3  
Old 11-23-2006
Info required for tcsh script

Hi All,

Is it possible to "switch" like this in tcsh?

switch ( "$var" )
case "1" || "2" :
set something
breakesw
case "4" || "5" || "6" :
set otherthing
breakesw
endsw
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Strange problem with shell script commands

i have a very strange problem.....i gave the following command on the terminal sed '15 w temp' f1 -n | temp1=$(awk '{printf $3}' temp) | sed '/'$temp1'/s/1.330000/1.232032/' f1 > f10 where f1, temp and f10 are filenames. This works sometimes and the same command doesn't work sometimes.... (2 Replies)
Discussion started by: Agastya
2 Replies

2. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

3. Shell Programming and Scripting

some strange problem with return data in script

Hi, I have come across a little strange problem in my script. i tried the same logic in some other script where its working fine. but in other script its not behaving as expected. Here is the code: #!/bin/bash run_count="2" catalog_name="demo" cd... (3 Replies)
Discussion started by: sukhdip
3 Replies

4. UNIX for Dummies Questions & Answers

Strange perl print output behaviour

Hi, Today I have found the following case in perl: print "length:$lengths\tsum:". $count{$lengths}+$count_pair{$lengths}."\tindi:$count{$lengths}\t$count_pair{$lengths}\n";This give output as That means the first part of print is not printing. Only the values after the additions are printed.... (5 Replies)
Discussion started by: gvj
5 Replies

5. Shell Programming and Scripting

ksh vs perl strange interaction.

Hello everybody, I isolated an issue: please try the following script (under AIX) #!/usr/bin/ksh93 echo "Before Perl: \c" read line echo "|$line|" perl -e 'print "Perl invocation";' echo echo "After Perl: \c" read line echo "|$line|" On the first input, type Ctrl-D. It works... (13 Replies)
Discussion started by: jlovi
13 Replies

6. Shell Programming and Scripting

[Perl] Strange problem with array

Hi, I have a strange problem with arrays in Perl. That is to say, for me it is strange and perhaps there is a special reason for it that I do not know of. Not a real Perl Ace. This is the program, as an example: #!/usr/bin/perl -w #-d use strict; my $pu; my $pu_list_cmd; my... (2 Replies)
Discussion started by: ejdv
2 Replies

7. Shell Programming and Scripting

Strange behaviour with perl i/o?

Hi All, I got a strange problem here. I have a perl script which is fetching data from a database table and writing a file with that data. If i run that script from linux command line, the file it creates is a normal ascii text file without any binary character in it.But... (9 Replies)
Discussion started by: DILEEP410
9 Replies

8. Shell Programming and Scripting

problem in perl script

Hi, Here is my piece of code. #!/usr/bin/perl my $logFile = $ARGV; die "usage: $0 <logFile>" unless $logFile; die "Logfile $logFile doesn't exist" unless -f "$logFile"; my %no_of_questions; my %timestamp; open (FP,"<$logFile") or die "unable to open file $!" ; @records=<FP>;... (4 Replies)
Discussion started by: namishtiwari
4 Replies

9. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies
Login or Register to Ask a Question