#!/usr/local/bin/perl use strict; my @dow=(); #array initialization is different from indexes initialization $dow[0]=undef; $dow[6]= "sat"; for(my $i=0; $i <=6;$i++){ if(!(defined($dow[$i]) || exists($dow[$i]))){print "\$dow[$i] \t not defined\n";} if(exists($dow[$i]) && !defined($dow[$i])){ print "\$dow[$i]\texists\t not defined\n"; } if(exists($dow[$i]) && defined($dow[$i])){ print "\$dow[$i]\texists\t defined\n" ;} }