in reply to Re: Only joining elements of an array that are defined
in thread Only joining elements of an array that are defined
Just a nit,
grep $_, @arraywill not include false but defined values:
Outputuse strict; use warnings; my @array = (1, 2, undef, 4, 5, 0, undef, 8, 9); print join (' ', grep $_, @array)."\n"; print join (' ', grep { defined } @array)."\n";
1 2 4 5 8 9 1 2 4 5 0 8 9
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Only joining elements of an array that are defined
by GrandFather (Saint) on Feb 14, 2006 at 10:38 UTC | |
|
Re^3: Only joining elements of an array that are defined
by Anonymous Monk on Feb 14, 2006 at 10:49 UTC | |
by tirwhan (Abbot) on Feb 14, 2006 at 11:11 UTC | |
by Fletch (Bishop) on Feb 14, 2006 at 14:19 UTC | |
by blazar (Canon) on Feb 15, 2006 at 09:55 UTC | |
by Anonymous Monk on Sep 15, 2018 at 09:52 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |