On Dec 23, 2003, at 9:03 AM, denis@teachlinux.com wrote:
[..]
> Sorry for the curt thank you. You code looks really good.
I'd never thought of it that way. What I think might
be the elegant way of saying 'thank you' to folks who
offer an idea/code/suggestion/BriefPsychoticEpisode would
be something on the order of
a. demonstrating what one had 'learned' from the code, idea, ....
b. being able to help others with what one learned to others.
Often times folks don't have the time, due to the press
of what ever it was that got them tossing a 'current issue'
into play...
> On Mon, 22 Dec 2003, drieux wrote:
>> On Dec 22, 2003, at 4:32 PM, denis@teachlinux.com wrote:
[..]
>>
>> So you might try the idea of
>>
>> my ($line1, $line2 , $flag );
>> while ( 1 ) {
>> $line1 = <TESTFILE>; # read them each
>> $line2 = <LOGFILE>;
>
> never thought of reading two files one line at a time like this,
> looks so easy once you showed me.
the gooder news is that it 'solves' the problem
you asked about - the information is that it is
still not clear which way you really want to go.
you might check out MJD's 'diff' in perl:
<http://www.perl.com/language/ppt/src/diff/diff.mjd>
>
>> last unless ( $line1 || $line2 ); # if both empty exit loop
>> #
>> # otherwise test for which one just finished
>> #
>> unless( $line1 )
>> {
>> $flag = 1;
>> last;
>> }
>> unless( $line2 )
>> {
>> $flag = 2;
>> last
>> }
> a much better line check then the "junk" I wrote.
actually upon reflection I thought
$flag = 1 unless( $line1 );
$flag = 2 unless( $line2 );
last if $flag;
would solve that part - but had it fanned out
in case you wanted to do something specific with
either case....
The trade offs are basically simple:
a. slurp in both files using a common slurper function
then call a compare_slurpie()
b. find a neater data model that will allow you to
parse the files for the information you need, write
one grot_data_from_file() method, call it twice and
then a compare_grotted_data()
c. pass in two file_names and grovel in parrallel as is
line by line...
[..]
ciao
drieux
---
Thread Previous
|
Thread Next