#!perl -w use warnings; use strict; use CGI; print "$] $CGI::VERSION\n"; sub Foo::get_end_date { return undef } my $pa = bless {}, 'Foo'; print CGI->new->textfield(-name=>"end_date", -default=>substr($pa->get_end_date(),0,10)), "\n"; __END__ 5.026000 4.36 Use of uninitialized value in subroutine exit at .../CGI.pm line 472. #### $ perl -wle 'sub x{@_} print x(substr undef,0)'