Code Comments
Programming Forum and web based access to our favorite programming groups.Hi,
i have to compare two files with eachother and work out the differences.
I found the module Text::Diff, that would do this task fine, as it says
on the description.
I tried it like that:
use Text::Diff;
my $d = Algorithm::Diff->new (@array1, @array2);
but it throws me this Error:
Can't use string ("w") as a HASH ref while "strict refs" in use at
$perlpath/lib/Text/Diff.pm line 589.
Can anyone tell me, what is wrong on that?
Post Follow-up to this messageSebastian Hagedorn schrieb:
> Hi,
>
> i have to compare two files with eachother and work out the differences.
> I found the module Text::Diff, that would do this task fine, as it says
> on the description.
> I tried it like that:
>
> use Text::Diff;
> my $d = Algorithm::Diff->new (@array1, @array2);
>
> but it throws me this Error:
>
> Can't use string ("w") as a HASH ref while "strict refs" in use at
> $perlpath/lib/Text/Diff.pm line 589.
>
> Can anyone tell me, what is wrong on that?
>
Ok, I'm already done:
my $d = Algorithm::Diff->new(\$string1, \$string2, {STYLE => "Context"});
print $$d;
But this gives me the following error:
Not an ARRAY reference at $perlpath/lib/Text/Diff.pm line 164.
Whats wrong with it?
Post Follow-up to this messageIn article <62o0enF23vch4U1@mid.dfncis.de>, Sebastian Hagedorn
<sebastian.hagedorn@rub.de> wrote:
> Sebastian Hagedorn schrieb:
> Ok, I'm already done:
>
> my $d = Algorithm::Diff->new(\$string1, \$string2, {STYLE => "Context"});
> print $$d;
>
> But this gives me the following error:
> Not an ARRAY reference at $perlpath/lib/Text/Diff.pm line 164.
>
> Whats wrong with it?
Algorithm::Diff requires two array references. Text::Diff has a more
flexible interface as a front-end to A:D, but judging from its
documentation does not have an object-oriented interface. Try
(untested):
use Text::Diff;
my $diff = diff( \$string1, \$string2, { STYLE => "Context" });
or
use Algorithm::Diff;
my $d = Algorithm::Diff->new( \@array1, \@array2 );
--
Jim Gibson
Posted Via mcse.ms Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.mcse.ms
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.