Skip to content

Instantly share code, notes, and snippets.

@petdance
Last active March 23, 2016 14:43
Show Gist options
  • Save petdance/e0557bc9b0a8ea16feef to your computer and use it in GitHub Desktop.
Save petdance/e0557bc9b0a8ea16feef to your computer and use it in GitHub Desktop.
Incorrect uninitialized value messages in sprintf
$ perl -v
This is perl, v5.10.1 (*) built for x86_64-linux
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
$ perl -w -E'my $x = "foo";my $y = sprintf "%d $x";'
Use of uninitialized value $x in sprintf at -e line 1.
$ perl -w -E'my $x;my $y = sprintf "%d".($x//"")'
Use of uninitialized value $x in sprintf at -e line 1.
$ perl -w -E'my $x="%d";my $y = sprintf $x'
Use of uninitialized value $x in sprintf at -e line 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment