Bjørge Solli wrote:
Please use more descriptive sibjects!
I second that ;p And more info on where you're gettign reandom functions
from :)
[snip]
But in variable $cp proper value is not coming .Either it should come as 0
or1 but it's coming as any junk value or no.
Where in the documentation do you see that it is either 0 or 1?
It will be "false" (IE undef, "", or 0) or "true" (anything not false:
1, 42, 78, a, b, c, etc)... google boolean for more info.
dircopy($FROM_DIR,$TO_DIR) or die("Copying failed"); # should also work
# use $! to find out why :)
dircopy $from, $to or die "Copy failed: $!";
If you read the manual for dircopy you will see that it doesn't return a
"successfull/unsuccesfull" boolean, but a list:
my($num_of_files_and_dirs,$num_of_dirs,$depth_traversed) = dircopy($orig,
$new);
So the "junk" value you are refering to is the number of files and dirs
copied. If it fails it probably returns a undef value.
Not probably, it does :) If in doubt check out the POD or the source.
if(dircopy $from, $to) {
print "Copied ok!\nStarting port copy tasks\n";
...
}
else {
print "Copy failed: $!\n";
}
but
dircopy $from, $to or die "Copy failed: $!";
is much more conscise if you program's continuation depends on the copy
working...
but that seems a bit unne
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>