in reply to is this correct

It is broken, but not at line 12.

Line 13 should read:

print FILE $text;
As it stands now, it reads in the file, prints the untabbified text to STDOUT, and truncates the supplied user-specified file.

Replies are listed 'Best First'.
Re: Re: is this correct
by PsychoSpunk (Hermit) on Feb 02, 2001 at 22:36 UTC
    And assuming you actually run the program, you'll see that problem firsthand and quickly fix that line so it acts correctly.

    (Note: this is simply a friendly suggestion that some attempt be made to understand the program/problem when you post.)

    ALL HAIL BRAK!!!

      PsychoSpunk this is my second day tring to program in perl since the program wasnt running correctly i did try to fix the problem but since i dont have any experience in perl thats alittle hard without the help of you guys(fellow monks). thanks for your help snowrider
        So it is always a good practice to enable warnings in your script when you are programming for testing...
        #!/usr/bin/perl -w
        that way you can "see" where the problem is happening
        Chady | http://chady.net/
Re: Re: is this correct
by el-moe (Scribe) on Feb 03, 2001 at 05:19 UTC
    You could also do this...
    select(FILE); print $text; print "blah blah blah\n";
    And so on... all prints would go to FILE

    Update:
    Snowrider - This is assuming you have multiple files open and are printing to them as you go... and as I know the basic tasks you will have to perform as you come up to speed with Perl... this might be useful to you.

    i.e.,

    open DRILL_FILE, ">$drill_file"; open ROUT_FILE, ">$rout_file"; select(DRILL_FILE); print "stuff...\n"; select(ROUT_FILE); print "other stuff...\n";

    Prost,
    Moe