While reading from a configuration file in Perl there might be cases when a line is invalid and it does not need to get added to my array of valid lines. Since I'm using a for loop here, even the invalid lines create an undef entry. How can I remove all them afterwards?

Thanks!

有帮助吗?

解决方案

@array = grep defined, @array;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top