This is a classic example of the admonition, "Never trust data."

        I did try the following:

David Precious writes:
> change "system" to "print" to print out the command that would be run,
> and (a) you'll likely see the problem, or (b) you can try running that
> exact command.

        I had tried echo as the system() command and I thought
it was okay but after a night's sleep and trying the print
command as suggested, the problem was obvious. I had gotten
$filename from the following code snippet:

foreach $keyfile (@filenames) {    #Checking this key file.
    $kpath = $keyfile;
    ( $filename, $directories, $suffix ) = fileparse($kpath);

        I went on to use $filename without making sure it was
clean. It has an embedded newline at the end and

chomp($filename);

fixed everything.

        The temporary print statement showed the 1 line becoming
2 and a trace of $filename in perl -d clearly showed the
newline.

        I feel embarrassed for wasting everybody's time, but I
really appreciate the help.

Martin


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to