Dear 2Teez,
I've been trying to solve my little programming problem using the module, however, due to my lack of experience, I somehow have not been able to run the comparison properly
What I did not understand in the CPAN description was the fact that only one array is used for the comparison, e.g.
diff \@a, $b { STYLE => "Table" };
I would have expected to have two @arrays for comparision, e.g.
my @xml_files = glob( '*xml' );
#say for @xml_files;
my @bak_files = glob( '*bak' );
#say for @bak_files;
#using the Text::Diff::Table for comparison
my $format = "";
my @joint_files = @xml_files, @bak_files;
my @results = diff \@joint_files, $format { STYLE => "Table" };
say for @results;
However, I am getting the following error message, saying that the module is not install properly
C:\dev>perl comparing_files_3_using_text_diff.pl ./file_compare_on_lis
+ts
Can't locate package Text::Diff::Base for @Text::Diff::Table::ISA at c
+omparing_f
iles_3_using_text_diff.pl line 4.
Backslash found where operator expected at comparing_files_3_using_tex
+t_diff.pl
line 20, near "diff \"
(Do you need to predeclare diff?)
syntax error at comparing_files_3_using_text_diff.pl line 20, near "di
+ff \"
Global symbol "%format" requires explicit package name at comparing_fi
+les_3_usin
g_text_diff.pl line 20.
Global symbol "@results" requires explicit package name at comparing_f
+iles_3_using_text_diff.pl line 22.
I suppose I have to use the module as is, but what does $b represent and why can't it be changed to $format?
Could somebody give me a hint why I am getting the error message despite the module being installed?
I am confused about these package name declaration, I thought I did everything by the book
Thanks a mil in advance for your support
Kind regards
C.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.