Dhiraj P Nilange wrote: > > Hello Hello,
> I have a very urgent and important question. > How do I declare or use file handle locally > in PERL? It's either Perl or perl not PERL perldoc -q 'the difference between "perl" and "Perl"' > I am writing a recursive sub to > locate files in subdirectories. This sub > calls itself when it finds directory ; if > there are directory under this directory > again then again it calls itself. Maybe you should use the File::Find module, it is designed for just this purpose. > The problem > is that as I am unable to declare filehandle > (I am using "readdir" and "opendir" builtin > functions) ; in subsequent calls to the > sub ; the HANDLE refers to the firstmost > opened directory. > > if I used "my" keyword for this purpose then > perl gives error. > > So how to define file handle locally? its my > urgent need! local *DIRHANDLE; opendir DIRHANDLE, $dir or die "Cannot open $dir: $!"; # etc. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]