Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Not able to replace to directory paths

by Eliya (Vicar)
on Mar 10, 2011 at 23:26 UTC ( [id://892566]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Not able to replace to directory paths
in thread Not able to replace to directory paths

Maybe you should close $P4DIFF before you open the associated file?

Depending on how much you've written, the IO buffer (size 4k) might not have been flushed yet, so the file behind $DATA could be empty.  In other words, you'd get EOF with the loop quitting right away...

This doesn't print anything (i.e. while loop not entered):

open(my $P4DIFF, '+>', "p4diff.log") or die $!; print $P4DIFF "foo\n" x 3; # close $P4DIFF; my $input = "p4diff.log"; open my $DATA, '<', $input or die "could not open '$input' $!"; while (my $line = <$DATA>) { print ">> $line"; }

while if you uncomment the close, you'd get:

>> foo >> foo >> foo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found