On Fri, 31 Jul 2009, anirudh nair wrote: > On Wed, Jul 29, 2009 at 9:11 AM, Saifi Khan <[email protected]>wrote: > > > > > > > On Wed, 29 Jul 2009, anirudh nair wrote: > > > > > Hii guys > > > > > > I wrote this Perl code to find duplicate files in a directory. > > > > > > sub md5_finder{ > > > open(FILE, $_[0]) or die "Can't open $_[0]: $!"; > > > binmode(FILE); > > > Digest::MD5->new->addfile(*FILE)->hexdigest; > > > } > > > > Aniruddh, how does the md5_finder() function work ? > > > > . > > > > md5_finder() takes the file path as its argument. > A file handle FILE is opened to $_[0](which conatins the path) > then Digest::MD5->new->addfile(*FILE)->hexdigest calculates the md5 digest > and is returned back. > hexdigest returns the digest in hexadecimal form > > Cheers > Anirudh >
Thanks Anirudh, that helped get an overview. Is binmode() used to change the stream type to byte based reading ? thanks Saifi. http://twitter.com/saifikhan

