Hi there.

Why not use File::Find?  It does this sort of recursion for you.

>From the Perl Cookbook:

"File::Find provides a convenient way to process a directory recursively. It
does the directory scans and recursion for you. All you do is pass find a
code reference and a list of directories. For each file in those
directories, recursively, find calls your function.

Before calling your function, find changes to the directory being visited,
whose path relative to the starting directory is stored in the
$File::Find::dir variable. $_ is set to the basename of the file being
visited, and the full path of that file can be found in $File::Find::name.
Your code can set $File::Find::prune to true to tell find not to descend
into the directory just seen."



/D\eR?eK
"It is the custom of each community
to form the minds of its young in a
mould, introducing a binding agent
of prejudice."


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Veeraraju_Mareddi
> Sent: October 10, 2001 02:51
> To: '[EMAIL PROTECTED]'
> Cc: '[EMAIL PROTECTED]'
> Subject: Calling function in the same fuction :Recursion
>
>
> Dear All
>
> I am trying to call a function from the function itself.But after
> ending the
> function it should be having previous values in the calling function, But
> the called function ,being the same function is modifying the
> some variable
> values.
>
>
> Ex:
>
> Suppose I am searching for a file in root dierectory.
>
> it reads  the DIR  and get all entries into an array.In array ,again it
> reads all files, and if the element is directory it should call the same
> fuction (RECURSION). and so.
>
> But in doing so Once it went to some sub directories ,Its not coming back
> and exiting.
> That means it goes for first directory and then search and if it
> is again a
> directory ,it goes inside. But not coming back..
>
>
> Please suggest me to achieve this..
>
> I want to run through directory structure..
>
>
> Thaking you Very much..
>
> With Best Regards,
> RajuVM
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to