drodinthe559 has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know how to print source and destination in a print command?
copy($source, $targetdir1) or die "Copy Failed: $!";
Is it this?
print copy($source, $targetdir1) or die "Copy Failed: $!";
Thanks, Dave

Replies are listed 'Best First'.
Re: print copy source and destination
by GrandFather (Saint) on Oct 01, 2008 at 22:52 UTC

    Do you mean:

    print "Source: $source. Target: $targetdir1\n";

    Perl reduces RSI - it saves typing
      I thought there is a way to put the print command directly into the copy command, but I could be wrong. I thought someone should me how to do that.

        What do you actually want printed? Print and copy are orthogonal operations - I don't understand how it makes sense to "put the print command directly into the copy command" unless you mean to modify the copy sub to print its parameters.

        if you want a modified copy sub you could:

        sub myCopy { my ($source, $target) = @_; print "Copying from $source to $target\n"); return © }

        Perl reduces RSI - it saves typing
Re: print copy source and destination
by chrism01 (Friar) on Oct 02, 2008 at 06:25 UTC
    Perhaps you mean this:

    copy($source, $targetdir1) or die "Copy $source to $targetdir1 Failed: $!\n";

      I thought it was like the example I gave above, but I could be wrong. I just stick with what the consensus is providing as a solution.
Re: print copy source and destination
by JavaFan (Canon) on Oct 01, 2008 at 23:29 UTC
    Is it this?

    Surely, trying it out yourself would give you an answer quicker than asking it on Perlmonks?