in reply to How to avoid "Use of uninitialized value" with printf?

:) Please don't describe things your posted code doesn't demonstrate :)

You pretty much right about what happens, you can disable those warnings with  no warnings q{uninitialized};

$ perl -le " use strict; use warnings; printf qq{%-12s %-12s\n}, @ARGV + " Missing argument in printf at -e line 1. Missing argument in printf at -e line 1. $ perl -le " use strict; use warnings; printf qq{%-12s %-12s\n}, @ARGV + " what Missing argument in printf at -e line 1. what $ perl -le " use strict; use warnings; printf qq{%-12s %-12s\n}, @ARGV + " what what what what $ perl -le " use strict; use warnings; use diagnostics; printf qq{%-12 +s %-12s\n}, @ARGV " Missing argument in printf at -e line 1 (#1) (W uninitialized) A printf-type format required more arguments tha +n were supplied. $ perl -le " use strict; use warnings; no warnings q{uninitialized}; p +rintf qq{%-12s %-12s\n}, @ARGV " $ perl -le " use strict; use warnings; no warnings q{uninitialized}; p +rintf qq{%-12s %-12s\n}, @ARGV " oh oh $ perl -le " use strict; use warnings; no warnings q{uninitialized}; p +rintf qq{%-12s %-12s\n}, @ARGV " oh yeah oh yeah

Replies are listed 'Best First'.
Re^2: How to avoid "Use of uninitialized value" with printf?
by bobdabuilda (Beadle) on Apr 11, 2012 at 02:46 UTC

    Thanks for the response, Anon. One question for you - when in a position to not provide the original data you are working with... how, exactly, is one supposed to formulate a question?

    I did what I thought was the best solution to this, which was to post up some working code, with an example of equivalent data, combined with an explanation of the symptoms I am seeing. The code snippet was kept the same as the original, aside from the lines I commented out (rather than simply deleting them, for visibility, in case there was an issue with the way those lines were being used).

    Please tell me how I could have presented my question better/more clearly so that I can ensure I do so in future?

      Please tell me how I could have presented my question better/more clearly so that I can ensure I do so in future?

      :) Yeah, I probably should not have lead with that comment, not that I remember , nor can I even guess what I was referring to. Your question is very well presented (practically perfect). Mea culpa.

      Are you clear on the issue of the warning?

      Here is another way with Perl6::Form ( also documented at http://search.cpan.org/dist/Perl6-Doc/share/Exegesis/E07.pod ) based on demo_columns

      the more verbose version

      use Perl6::Form; print form {layout=>"across"}, '{:[{10}]:} {:[{10}]:} {:[{10}]:} {:[{10}]:} {:[{10}]:} {:[{10}]:} ', \@UACS , \@UACS , \@UACS , \@UACS , \@UACS , \@UACS ;

      or the same thing using the repeat operator

      use Perl6::Form; print form {layout=>"across"}, '{:[{10}]:} ' x 6 , ( \@UACS ) x 6;

      Place either right after  @UACS = sort(@UACS);, no splicing required, and @UACS remains full afterwards

        Ahhh alrighty, thanks for clearing that up... still new to posting here, so doing my best to get it right... always best to make it easier on the folks you're asking for help as possible, is my philosophy :D

        Also, thanks for the additional options... unfortunately, I'm not able to check those out, as I'm currently stuck with 5.8.8. Thankfully I have some other suggestions to work with once I get some more time to work on this one :)