Sidharth wrote:
> 
> hi all,

Hello,

> i am new to this group.

Please set your software to limit line lengths to less than 80
characters and use plain ASCII text instead of quoted-printable MIME.

> hope get maximum benifit out of this group.
>   currently  i am  writting a script   wherein  i hav to creat a temporary file in 
> each sub directory starting  from main dir and  write in to that file
> 
> i hav  to expand each make file within each sudirectory  and place that temp file 
> there itself
> 
> i tried following
> 
> sub1{
  ^^^^
That won't work.

> ......
> $path=$mainpath.$tempfile

Missing semicolon at end of line.

> open(FD,">$path")

You should *ALWAYS* verify that the file opened correctly and missing
semicolon at end of line.

> printfile($path,*FD);

Is there any reason that you are using a typeglob instead of a lexical
scalar for the filehandle?  Which version of Perl are you using?

> ....
> }
> 
> sub printfile{
> 
> $fileloc=SHIFT

Have you declared your own function named 'SHIFT'?  Missing semicolon at
end of line.

> $filpediscriptor=SHIFT;
> here  i cal a readfile routine which returns me the   contents of file in array 
> @lines
> for each line($line) in array i do the following

You should put a # at the beginning of comments.

> for(  for ech $line of @lines){

That is not correct Perl syntax

> check if it contains include stmt if so {
>          get that  include file loc and pass it to printfilesubroutin
>          printfile($includefileloc , *$filpediscriptor);

$filpediscriptor supposedly already contains a typeglob so that is like
doing:

printfile($includefileloc , **FD);

>  }
> else
> {
>   write content of  makefile to temp file creatred in each subdirectory
> print  $filediscriptor , $line
                        ^^^
The comma tells print() to treat the first argument as a string, not a
filehandle.

perldoc -f print

> }
> close($filediscriptor);
> 
> }
> 
> the probleem  here  the temporary file created in each subfolder is  not complete it 
> is truncated.
> 
> am passing the file discriptor currectly in recursive subroutine

Please post actual Perl code.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to