Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Problems with Text:Diff
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?


Report this thread to moderator Post Follow-up to this message
Old Post
Sebastian Hagedorn
02-28-08 09:05 AM


Re: Problems with Text:Diff
Sebastian 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?

Report this thread to moderator Post Follow-up to this message
Old Post
Sebastian Hagedorn
02-29-08 03:04 AM


Re: Problems with Text:Diff
In 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

Report this thread to moderator Post Follow-up to this message
Old Post
Jim Gibson
02-29-08 03:04 AM



http://www.CheapVideoBlog.com/WatchMovie?id=726648

Report this thread to moderator Post Follow-up to this message
Old Post
Lunke
03-16-08 12:33 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 02:58 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.