in reply to Closing a system process after file creation (was: One for the Wisest Monks)

If you really want to use system commands and not straight perl, try:
system "touch $num.bat";
Has the advantage of not doing anything to the file (except changing it's timestamp) if it already exists.

Replies are listed 'Best First'.
•Re: Re: One for the Wisest Monks
by merlyn (Sage) on Jun 02, 2002 at 19:01 UTC
    system "touch $num.bat";
    But that unnecessarily starts a separate process, and is subject to security issues regarding the contents of $num.

    Much safer and faster:

    open DUMMY, ">>$num.bat"; close DUMMY;

    -- Randal L. Schwartz, Perl hacker

      system touch => "$num.bat";
      doesn't suffer from security issues regarding the content of $num. As for "much faster", I'm not quite convinced. You're doing disk I/O here, and that's likely to be the bottleneck anyway.

      Abigail

Re: Re: One for the Wisest Monks
by TexasTess (Beadle) on Jun 02, 2002 at 12:12 UTC
    I like it!
      Have it implemented and it's working GREAT! Thanks again!

      TexasTess
      "Great Spirits Often Encounter Violent Opposition From Mediocre Minds" --Albert Einstein