[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible bug in array handling after end of input (END handler)
From: |
Davide Brini |
Subject: |
Re: Possible bug in array handling after end of input (END handler) |
Date: |
Fri, 4 Dec 2020 19:39:07 +0100 |
On Fri, 4 Dec 2020 15:28:54 +0100, Christian Schmidt <cs@aibiot.de> wrote:
> Dear gawk maintainers,
>
> I stumbled across an unexpected behavior where a for (var in array)
> construct encounters each array element twice if called from an END
> handler.
>
> A small test case:
>
> === begin t.awk ===
> function dump() {
> for (i in vars) printf ("%s:%s ", i, vars[i]);
> print;
> delete vars;
> }
The 'print;' above is equivalent to 'print $0'. If you want to just print a
newline, use 'print ""' or 'printf "\n"'.
Regards,
--
D.