#!perl use warnings; use strict; use 5.010; # required for // my %h = (a=>undef, b=>2); my ($x,$y) = (undef, 'why not'); warn "-"x20, __LINE__, "\n"; printf "will warn: x=|%s| y=|%s| ha=|%s| hb=|%s|\n", $x, $y, $h{a}, $h{b}; warn "-"x20, __LINE__, "\n"; printf "will id: x=|%s| y=|%s| ha=|%s| hb=|%s|\n", $x//"", $y//"", $h{a}//"", $h{b}//""; warn "-"x20, __LINE__, "\n"; sub dbg_printf { printf @_; for my $i ( 0 .. $#_ ) { my @ord = qw(th st nd rd th th th th th th); warn ">> it was the ${i}" . $ord[$i%10] . " argument to dbg_printf() that was not defined \n" unless defined $_[$i]; } } warn "-"x20, __LINE__, "\n"; dbg_printf("will warn, but expand: x=|%s| y=|%s| ha=|%s| hb=|%s|\n", $x, $y, $h{a}, $h{b}); warn "-"x20, __LINE__, "\n";