in reply to Minimum width in printf() ignored?

I am not able to reproduce your findings.

use strict; use warnings; my $out = sprintf ("Two names: '%-16s', '%-16s' for ", 'E6/11/C#', 'E6 +/11/Db'); print $out . "\n";

I would not usually write it this way but I have preserved your syntax just to show the similarity. This runs and produces the following output:

Two names: 'E6/11/C# ', 'E6/11/Db ' for

That is what I expect. Perhaps you could also provide an SSCCE?


🦛

Replies are listed 'Best First'.
Re^2: Minimum width in printf() ignored?
by Miq19 (Novice) on Sep 01, 2024 at 15:24 UTC
    Thanks for your support. I tried
    perl -e '$a = "foobar"; printf("#%16s#\n", $a);'
    and got
    # foobar#
    as was to be expected - that was the reason I posted my question here. Even using static strings as you did in your example are working:
    Two names: 'foo ', 'bar ' for D#/Eb4, +F#/Gb4, A#/Bb4, F5,
    It must be something with the two variables, but I have no clue...