in reply to Question: Is undef a valid argument?
#! /usr/bin/perl use strict; use warnings; print scalar @ARGV, "\n"
outputs 0. By explicitly accessing the non-existent array element, perl extends the array and populates those new values with undefs, and that is what gets passed to your subroutine. This is a manifestation of autovivification.. As ikegami points out, this isn't autovivification, but it is returning an undef as you attempt to access the undefined array element.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Question: Is undef a valid argument?
by ikegami (Patriarch) on May 06, 2009 at 20:37 UTC |