On 3=EC=9B=9419=EC=9D=BC, =EC=98=A4=ED=9B=8411=EC=8B=9C31=EB=B6=84,
gaze...@[EMAIL PROTECTED]
(Kenny McCormack)
wrote:
> In article
<5de8b96e-75af-4e74-9c9f-46d9c5dc6...@[EMAIL PROTECTED]
>,iaminsik =C2=A0<iamin...@[EMAIL PROTECTED]
> wrote:
>
> ...
>
> >I've never heard of declare variables as 'local' in awk.
>
> TAWK has true local variables, which is very nice, but in "standard"
> AWK it is done via a (widely accepted and practiced) kludge. =C2=A0See
bel=
ow.
>
>
>
> >> I would declare then (in the "function" statement) so there would be,
> >> for example, no chance of "i" in one routine conflicting with "i" in
> >> another.- =C2=B5=C3=BB=C2=BF=C3=82
=C3=85=C3=98=C2=BD=C2=BA=C3=86=C2=AE=
=C2=BC=C3=BB=C2=B1=C3=A2=C2=B1=C3=A2 -
>
> >Can you show an example?
>
> The idea is that you declare your funciton like this:
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 function foo(arg1,arg2, =C2=A0 =C2=A0 =C2=A0
=
=C2=A0 tmp1,tmp2,tmp3) {}
>
> And then call it with only 2 args. =C2=A0The additional args get
initalize=
d
> to "" (as if they had been passed by the caller as ""), and act like
> local variables in the function.
>
> It is also conventional to separate the "real" args from the fake args,
> with whitespace, as I have done above.
Sorry for this late reply. :)
It's a nice trick.
I'll try!
Best Regards.
Remi.


|