#!/usr/bin/perl -w $arr[0]='a'; $arr[3]='d'; print join(" ", map { defined() ? $_ : '[undef]' } @arr),"\n";