SOLVED (not completely...): OT: help needed to debug Perl script
M. Fioretti
mfioretti at nexaima.net
Wed Oct 17 16:14:50 UTC 2018
On 2018-10-17 12:06, Colin Law wrote:
> On Wed, 17 Oct 2018 at 06:07, M. Fioretti <mfioretti at nexaima.net>
> wrote:
>> ...
>> 157 print "\nADDINGURX: $url;\n";
>> 158 print "\nADDINGURQ: $qq;\n";
>> ...
>> ~4700 lines starting with ADDINGURX
>> ZERO lines starting with ADDINGURQ
>
> Do you mean that line 157 is printing ok but the output from line 158
> never appears?
> Are you sure there is not another line there somewhere printing
> ADDINGURX?
Answering (indirectly) also to Joel:
the snippet of script that I posted is the part of the actual output of
#> cat -n myscript
So this code, from my original message:
147 my $keycounter = 1;
148
149 foreach my $qtq (sort keys %all) {
150
151 printf "\nALLCHECK: %6.6s >> %s;\n", $keycounter, $qtq;
152 $keycounter++;
153 }
154
155 foreach my $qq (sort keys %all) {
156 $url = $qq;
157 print "\nADDINGURX: $url;\n";
158 print "\nADDINGURQ: $qq;\n";
is lines 147 to 158 of the complete script, and consequently yes, I was
sure that there was no other Perl code at all playing tricks here.
What I have been trying to say, maybe badly, is:
a) the above is part of the actual code
b) I run the script dumping the output to a file, for further
processing:
#> myscript > datadump
c) and I get different numbers of lines from the three statements
(again,
what follows is ACTUAL output of grep at the shell prompt):
#> grep -c ^ALLCHECK datadump (=line 151 prints 26080 keys from the
hash)
26080
#> grep -c ^ADDINGURX datadump (=line 157 prints only 4732 keys from the
hash)
473
#> grep -c ^ADDINGURQ datadump (=line 158 prints only 4732 keys from the
hash)
473
now the "solution":
After looking at the whole flow from scratch, I found out that the
problem
seems to be 100% *outside* that specific Perl script, and somehow even
more
confusing (for me at least). But that deserves a different thread,
coming
in a few minutes.
Thanks!!!
Marco
--
http://mfioretti.com
More information about the ubuntu-users
mailing list