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

Re^3: Merge the difference between two files and save it on the first file. Also update the first file with info in second file.

by marinersk (Chaplain)
on Oct 11, 2013 at 21:15 UTC ( #1057952=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Merge the difference between two files and save it on the first file. Also update the first file with info in second file.
in thread Merge the difference between two files and save it on the first file. Also update the first file with info in second file.

Nicely done.

Funny that it felt like a homework assignemnt, showing that homework sometimes does reflect the real world :-).

That said, I can't see any particular issue with yoru code, other than the use of a variable for the file handle, which I'm seeing more and more of in Perl posts here. Has that become the "new normal"?

What you just did with that code, by the way, is essentially re-invent the sort/merge using Perl hashes to take care of all the dirty work for you. :-)

Looking forward to your next Perl issue.


Comment on Re^3: Merge the difference between two files and save it on the first file. Also update the first file with info in second file.
Select or Download Code
Re^4: Merge the difference between two files and save it on the first file. Also update the first file with info in second file.
by Shariq (Initiate) on Oct 14, 2013 at 02:52 UTC
    Thanks. But i have some issues with the code though. Its not perfect in the sense that when I have space between my configuration parameters, it gets messed up. For example:
    if this was my first file:
    A=hello

    B=world
    The I would have trouble reading and hashing. So I am limited in the sense that my files cant have new line in between the configuration settings.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-12-25 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls