http://www.perlmonks.org?node_id=89453


in reply to How do I print a partial array?

Another way....

foreach ( @b ) { print "$_\n" if defined $_; }

Edited by davido: Added "defined" to conditional so that elements containing '0' would still print, while undefined elements are skipped.