deprecated has asked for the wisdom of the Perl Monks concerning the following question:
One of the things it does is open a file thusly:
whereas I decided to use a hash and ditch the sort (1). This has been mostly successful, and cleaned up other areas of the code. I have a new problem in a similar vein, however:open (OUT, "|sort -u > $filename");
using diff (1) is very tempting, but I would rather not use any system calls in this case. I am, however, faced with adding, say, 10 lines of code instead of just using the diff.$compare = `diff $file1 $file2 2>&1`; $comapre =~ s/^\n$//; if ($compare ne "") { #fail ... }
I know that this is why the "worse is better" approach is sometimes taken by programmers, and I may just use it. But I'd really like to know if somebody has a solution that is simple and clear... Or opinions on using diff in this case <!- except I dont want to hear from you, tilly... ->.
thanks
brother dep.
--
Laziness, Impatience, Hubris, and Generosity.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: `diff`ing two files (code)
by mdillon (Priest) on Jul 20, 2001 at 20:38 UTC | |
|
Re: `diff`ing two files (code)
by bikeNomad (Priest) on Jul 20, 2001 at 22:27 UTC | |
|
Re: `diff`ing two files (code)
by larryk (Friar) on Jul 20, 2001 at 20:40 UTC | |
|
Re (tilly) 1: `diff`ing two files (code)
by tilly (Archbishop) on Jul 20, 2001 at 20:42 UTC | |
|
Re: `diff`ing two files (code)
by runrig (Abbot) on Jul 20, 2001 at 20:47 UTC | |
|
Re: `diff`ing two files (code)
by kevin_i_orourke (Friar) on Jul 20, 2001 at 20:44 UTC | |
|
Re: `diff`ing two files (code)
by Sifmole (Chaplain) on Jul 20, 2001 at 20:59 UTC | |
|
Re: `diff`ing two files (code)
by aquacade (Scribe) on Jul 21, 2001 at 07:15 UTC |