in reply to Change permissions after file is created

Guessing from the two lines of code you shared, $outfile most likely contains a filehandle, not a filename. Pass a filename to chmod instead, and all should be fine.

EDIT: also, as boftx pointed out, single quotes will keep perl from interpolating the variable into your string, so $outfile is being interpreted by your shell instead -- and most likely evaluates to the empty string, hence the error message.

  • Comment on Re: Change permissions after file is created

Replies are listed 'Best First'.
Re^2: Change permissions after file is created
by boftx (Deacon) on Jul 08, 2014 at 21:05 UTC

    Good catch on the filehandle. I overlooked that and just focused on a scalar inside single quotes.

    You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.