@arr[some very high no which causes a memory exception] = 88; # at this point $! is set to "Not enough memory" #I do some work here print "Hello world"; print "Hello world"; print "Hello world"; # here I check $! and $! is "Not enough memory" which means that the program threw "Not enough memory" at some point in time during its execution before this point. And it just happens that no other system call has generated any other error from the time "Not enough memory" was thrown. If the pevious array allocation didnt throw any error then $! here will be still unset or 0( thats what I expect, please correct me if I am wrong). if ($!) { # error exit(0); } print "$arr[0]";