in reply to Re^2: Use of uninitialized value in tie array
in thread Use of uninitialized value in tie array

scalar @array gives you the number of elements in an array. if( @array ){ will also only be true if the array contains at least one element.

Replies are listed 'Best First'.
Re^4: Use of uninitialized value in tie array
by Anonymous Monk on Apr 01, 2016 at 16:24 UTC
    You are saying something like this:
    ... my $dir_txt_files = "stuff/"; tie my @array, 'Tie::File', $dir_text_files or die "Could not open fil +e '$dir_text_files' $!"; if(@array) { unshift @array, 'NAME, ADDRESS, ZIPCODE' unless $array[0] =~ /^[a-z +A-Z]/; # Remove any blank lines. @array = grep /\S/, @array; } untie @array; ....

    Thanks!