if (@file != 0) {# @file in scalar context here - returns number of lines in the array #your stuff here }; #### if ($#file < 0) {# $#file returns max index of array #your stuff here };