Somu wrote:
use strict; use warnings; use File::Find; sub rm();
Remove the (). This prototypes the subroutine to force it to have no parameters. sub rm; In fact leaving this line out altogether is probably the best option. The subroutine doesn't need to be declared early.
my $count=0; my @dir = ("F://Hindi/RHTDM"); find(&rm,@dir);
You need to pass a reference to the subroutine. Your code is simply calling it and passing the return value to find(). find(\&rm,@dir);
sub rm(){$count++ my ($fname)= $_; if($fname=~ /mp3/){print "$count $fname"}
You should really check whether the file type matches 'mp3', rather than just checking whether 'mp3' occurs anywhere in the filename. And how about a newline after each output? if ($fname =~ /\.mp3$/){print "$count $fname\n"}
}
HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/