Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Writing a new file in Perl

by zwon (Abbot)
on Jul 05, 2012 at 11:12 UTC ( #980029=note: print w/replies, xml ) Need Help??

in reply to Writing a new file in Perl

while(/hops(.+)Trace/mg){ print $1, "\n" if /($RE{net}{IPv4})/; open FILE, ">Google_1" or die $!; print FILE "Important Information \n $1"; close FILE; }

Each time you call open, the file gets truncated. Either open it before the loop, and close after the loop, or open file for appending:

open FILE, ">>Google_1" or die $!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://980029]
[Mr. Muskrat]: Oh that is odd. I got the message that it was reparented but yeah, it didn't actually do it. lol
[Corion]: LanX: No, Co-Rion appears as Monkey God :-)
[Corion]: Mr. Muskrat: Yeah, that message is automatic when the "normal" reparenting is done, but I think some rows that make up the node were not added to the DB properly

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2017-01-19 16:32 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (170 votes). Check out past polls.