in reply to Re: pop an array
in thread pop an array

Strictly speaking the scalar is unnecessary. An array in a boolean context is true if it has elements and false if it's an empty list.

$ perl -le '@a = (); @b = (1); print "\@a" if @a; print "\@b" if @b;' @b

Replies are listed 'Best First'.
Re: Re: Re: pop an array
by Vautrin (Hermit) on Feb 09, 2004 at 14:46 UTC
    Strictly speaking it isn't necessary. I usually add it for clarity. TMTOWTDI.

    Want to support the EFF and FSF buy buying cool stuff? Click here.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Re: Re: pop an array
by ambrus (Abbot) on Feb 10, 2004 at 14:21 UTC
    (This is off-topic, but I never use scalar with @rrays. I use 0+@array. Indeed, most often uses of scalar can be changed to the shorter 0 + something or "" . something)