cthar has asked for the wisdom of the Perl Monks concerning the following question:
How do we add element to an array only if the element is non-empty? ie.... i have a list of element:
... etc so i want to add only a, b, c and d, ignoring the blank spaces. i tried:a b c d a a c d c
what am i doing wrong? thanks.unless($list eq " ") { push(@array, $list); }
Again... i dont want to store/add the repeated element.... ie my array will contain only a, b , c and d. Thanks.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Adding element to Array?
by cdarke (Prior) on Oct 13, 2009 at 08:43 UTC | |
Re: Adding element to Array?
by NetWallah (Canon) on Oct 13, 2009 at 05:30 UTC | |
Re: Adding element to Array?
by bichonfrise74 (Vicar) on Oct 13, 2009 at 05:49 UTC | |
Re: Adding element to Array?
by ph0enix (Friar) on Oct 13, 2009 at 07:16 UTC | |
Re: Adding element to Array?
by Marshall (Canon) on Oct 14, 2009 at 09:22 UTC |
Back to
Seekers of Perl Wisdom