in reply to Re: print question
in thread print question

unshift (@INC, "/db2/$DB2DBDFT/Scripts"); require 'variables.pl'; use Env;

This is declared at the top of my script, I am telling it to use Environment variables.

Works fine on Unix

I think it has to do with the USE% column because in that column there is ##% then it lists the directory. So when it sees the % in the varible $rc followed by the / of the directory it says "Error" you are trying to do printf on a / which cannot be formatted by printf.

Maybe I should be asking how to do a df command that drops the Use% column but gives me everything else?

Replies are listed 'Best First'.
Re^3: print question
by ikegami (Patriarch) on Jun 02, 2011 at 18:23 UTC

    So when it sees the % in the varible $rc followed by the / of the directory it says "Error"

    Nothing you showed looks at what's in $rc except print, and print does not treat % specially. From what you told us, your diagnosis is incorrect.

    You could get that error if the contents of the file you write to is used as a printf format string by something else.

Re^3: print question
by toolic (Bishop) on Jun 02, 2011 at 17:57 UTC
    Maybe I should be asking how to do a df command that drops the Use% column but gives me everything else?
    You could try parsing df output with the CPAN module: Filesys::Df

    Is it possible for you to reduce your code while still producing the same error? If you could post some code that anyone here could run, we might be able to help you debug it better. For example, does this simplified code still give you an error?

    use warnings; use strict; use autodie; open OUT, '> df.out'; my $rc = `df -h`; print OUT "$rc\n";