A=[1, 2, 3, 4 ] #### open(FIL, $file) || die "can't open file $^E\n"; while(chomp($_ = ) ne "]"){ #do stuff }