Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: print() on closed filehandle

by davis (Vicar)
on Dec 14, 2004 at 15:57 UTC ( [id://414741]=note: print w/replies, xml ) Need Help??


in reply to Re^2: print() on closed filehandle
in thread print() on closed filehandle

The correct answer is: "Try it, or read perldoc -f open". The short answer is that using ">" in your open will (attempt to) open the file, clobbering (ie removing) its contents, or creating the file anew if necessary.

Update: added documentation pointer.

davis
It wasn't easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.

Replies are listed 'Best First'.
Re^4: print() on closed filehandle
by Win (Novice) on Dec 14, 2004 at 16:12 UTC
    But my question really regards the system called statement.

      Sorry, but I cannot understand that. Could you rephrase?


      davis
      It wasn't easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.
        The program that calls the previously shown code is:
        #! perl -w scipt # The previously shown code is within 20_October_2004_K.pl use strict; use warnings; use File::Slurp; for (;;) { foreach my $job (read_dir("G:/PUB_HLTH/Perl_program/DSR_calcula +tion/20_October_2004/Input")) { next unless $job =~ /(.{1,20})\.txt$/; my $job_out; my $job_new_name; if ($job =~ /(.{1,20})\.txt$/){ $job_new_name = $1.".ran"; $job_out = $1."_out.txt"; #print $1.".out\n"; } U:/2004_2005/Development/Perl_development/20_October_2004/Output> system "perl 20_October_2004_K.pl G:/Directory_path/Input/$job G +:/Directory_path/Output/$job_out"; rename "G:/Directory_path/Input/$job", "G:/Directory_path/Input/$ +job_new_name" or warn $!; } sleep 5; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://414741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-03-28 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found