On 4/18/06, Irfan J Sayed <[EMAIL PROTECTED]> wrote: snip > can anybody plz tell me what i am doing wrong snip
What you are doing wrong is making assumptions and not reading the documentation. This is being compounded by your inexperience with Perl. First let us tackle the Perl ignorance: true and false are not 1 and 0. In fact, there is no one value for either true or false. The definition goes something like this: the values literal zero (0), undefined (undef), and empty string ('') are false and anything else is true. Note that this means the string '0e0' is true even though it is numerically equivalent to 0. Next, you have made the assumption that the return from the function will mimic the way command line programs work (0 for success and non-zero error code for failure.) A quick read of the documentation shows us otherwise. snip dircopy() snip returns true or false, for true in scalar context it returns the number of files and directories copied, In list context it returns the number of files and directories, number of directories only, depth level traversed. my $num_of_files_and_dirs = dircopy($orig,$new); my($num_of_files_and_dirs,$num_of_dirs,$depth_traversed) = dircopy($orig,$new); snip So, your code should read something like this my $cp = dircopy("D:\\vobs","D:\\backup"); if ($cp) { print " Copied $cp ", ($cp == 1 ? 'file' : 'files'), " successfuly\n"; } else { print " Copying failed\n"; } or this my ($cp, $dirs, $depth) = dircopy("D:\\vobs","D:\\backup"); if ($cp) { $cp -= $dirs; print " Copied $cp ", ($cp == 1 ? 'file' : 'files'), " in $dirs ", ($dirs == 1 ? 'directory' : 'directories'), " to a maximum depth of $depth", " successfuly\n"; } else { print " Copying failed\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>