in reply to Use of uninitialized value $_ in pattern match (m//)

@net_configs = undef; assigns an undef as the first and only element in the @net_configs array, so next loop through, it triggers the elsif, because the array is not empty.

Instead, undef the array as such:

undef @net_configs;

...or as others have stated, just re-initialize the array.