in reply to Tie::File to create a Hash?

A simple solution to your problem doesn't involve perl at all. Using the shell you can achieve this in just a simple line:

$ sed 's/=/ /' complex_file | join -a 1 -1 1 -2 3 simple_file -

This works only if you have the files sorted by the joint field, e.g:

$ mv simple_file simple_file.bk; sort simple_file.bk > simple_file $ mv complex_file comple_file.bk; sed 's/=/\t/' complex_file.bk | sort + -k 3,3r | sed 's/\t/=/' > complex_file

Hope this helps!

citromatik

Replies are listed 'Best First'.
Re^2: Tie::File to create a Hash?
by LittleGreyCat (Scribe) on May 31, 2007 at 15:26 UTC
    Interesting approach, and I can see where you are going.

    'join' seems to do more or less exactly what I want.

    Having 'sed' problems, though. The '/\t/' substitution seems to work on the character 't', not creating/removing a tab character as I expected.

    The resulting changes to the 't' in '/opt' give unexpected results.

    I will experiment further.

    Thanks

    Nothing succeeds like a budgie with no teeth.