FAQ
I'm using active state perl on win2k box, and need the script to create
zero byte length text files, like the touch command does in Unix. I've
been searching around for a couple of days now and haven't found anything.
Surely there's an easy way to do this? Thanks!

Search Discussions

  • John W. Krahn at Feb 11, 2005 at 8:57 am

    Mark Panasci wrote:
    I'm using active state perl on win2k box, and need the script to create
    zero byte length text files, like the touch command does in Unix. I've
    been searching around for a couple of days now and haven't found anything.
    Surely there's an easy way to do this? Thanks!
    Just open the file in write mode and then close it without writing any data to
    the file.

    open ZERO, '>', 'somefile' or die "Cannot create 'somefile' $!";
    close ZERO;



    John
    --
    use Perl;
    program
    fulfillment
  • Laurent Coudeur at Feb 11, 2005 at 9:24 am
    open file to create it then close

    open (FILE,">filename");
    close (FILE);

    should do the trick

    Regards.
    Laurent.
    -----Original Message-----
    From: Mark Panasci
    Sent: 11 February 2005 05:55
    To: beginners@perl.org
    Subject: How to create a blank text file on win2k

    I'm using active state perl on win2k box, and need the script to create
    zero byte length text files, like the touch command does in Unix. I've
    been searching around for a couple of days now and haven't found
    anything.
    Surely there's an easy way to do this? Thanks!

    --
    To unsubscribe, e-mail: beginners-unsubscribe@perl.org For additional
    commands, e-mail: beginners-help@perl.org <http://learn.perl.org/>
    <http://learn.perl.org/first-response>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedFeb 11, '05 at 5:55a
activeFeb 11, '05 at 9:24a
posts3
users3
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase