help in script modification

i have the following perl script.but it searches for a given filename.

i want to run the same script in my directoy which has subdirectories too and it has to display the file if sreach satisfies along with directory name.

can anyone help me:

perl script:

my $FILE = $ARGV[0];

for zf in *.bteq; do

if ($FILE eq "" )
{
print "File name $FILE not found \n";
exit;
}
my $count=0;
open(IN_FILE, $FILE) or die "cannot open outfile.txt:" . "$!";
my $comment = true;
my $FND = false;
while ($line=<IN_FILE>)
{
$count++;
if ($line =~ /^\/\/ || $line =~ /^\../)
{
my $comment = true;
next;
}
if ($comment eq "true")
{
if ( $line =~ /\*\/$/)
{
next;
}
else
{
$comment = false;
}
}

if \($FND eq "true" \)
\{
	print $line;
	chop\($line\);
	if \($line =~ /;$/ || $line =~ /;/\)
	\{
	  $FND= false;
	  next;
    \}	  
\}
if \($line =~ /^[ \\t]*CT|create[ ]*table[ ]*/gi\)
\{
	print $count.":".$line;
	$FND = true;
	next;
\}

}
close(IN_FILE);

run command:

perl perl.pl "Filename"

Thanks in advance

not sure if I have understood this. why do you want to use perl for finding the file ? can't you use 'find' with 'exec' option ? am I missing something ?

thanks.

actually my requirement is :

i have to search the create table definition in all the files and print the create table definition starting from CREATE TABLE to ;

hi,

i have modified it like this :

list_files()
{
if [ -f $1 ]
then echo $1; return;
fi

cd $1
echo; echo "Processing---> `pwd`:"; #Display Directory name

for i in *
do
if test -d $i #if dictionary
then
list_files $i #recursively list files
cd ..
else
echo $i; #Display File name
perl /home/sa230329/parse_bteq.pl $i
fi

done
}

if [ $# -eq 0 ]
then
echo "No Directory to list"
echo "Usage: recursive_dir_Parse.sh [Directory to list and Parse]"
exit 0
fi

for i in $*
do
DIR=$1
list_files $DIR
#shift 1 #To read next directory/file name
done

now i need some more modifications to this ..

the above script is listing the create table definition as required but i want the script to exclude one specific directory called "CTRL"
is there any way to do this ..

i have the following create table definition :

ct t15(
c1 varchar(32000),
c2 char(32000),
c3 int);

i have to store the table name in a var and serach for update and show table on that table in the file ..
if exists print the