On Mon, Dec 1, 2008 at 10:18 PM, David <[EMAIL PROTECTED]> wrote:
> Thank you to all who helped me get a 6 digit date into perl. I certainly
> heed warnings about not using outside system calls in perl however, I have
> to make an outside call again.
>
>
>
> #!/usr/bin/perl -w
> use strict;
>
> my $fileName = "081201 diskSpace.txt";
> my $fileLoc = "/Users/mini/diskSpaceLog/$fileName";
> system "(df -mg;) >$fileLoc &";
>

Your filename has a space in it, so  "/Users/mini/diskSpaceLog/081201"
and "diskSpace.txt" are being interpreted as two separate terms.

You need to escape the space. And you need to escape it for both the
shell and Perl double-quote interpolation:

    my $file = "081201\\ diskSpace.txt";

Alternatively, use single quotes in perl, and only escape it for the shell:

    my $file = q/081201\ diskSpace.txt/;

Better yet, use an underscore instead of a space in the filename. Both
you and the shell will be happier.

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.downloadsquad.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to