New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Absorber printf conversion #17166
Comments
From @jidanniCreated by jidanni@gmail.comFor cases like $ perl -we '@xyz = ( 1 .. 3 ); printf "X=%D Z=%d\n", @xyz[ 0, 2 ];' how about offering a different way: introducing the "absorber conversion"! $ perl -we '@xyz = ( 1 .. 3 ); printf "X=%D%q Z=%d\n", @xyz;' That's right, "%q" has simply eaten its argument and done nothing! Why would anybody want to do that? Well at least give users a choice. (Just like the "unpack" function has an "x" template. See perlpacktut.) Perl Info
|
From @jkeenanOn Wed, 02 Oct 2019 19:57:25 GMT, jidanni wrote:
Do you have any prior art for this feature request? Internet search for "absorber conversion" mainly turns up links for automotive shock absorbers? Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Wed, 02 Oct 2019 12:57:25 -0700, jidanni wrote:
You can already use %.0s to do this: $ perl -le 'printf "%s%.0s%s\n", "a", "b", "c"' though this will try to convert that second parameter to a string, which may have side-effects (like a warning if it's undef.) $ perl -Wle 'printf "%s%.0s%s\n", "a", undef, "c"' You can already reference printf parameters by index: $ perl -le 'printf q(%1$s%3$s), "a", "b", "c\n"' which avoids the side-effects: perl -le 'printf q(%1$s%3$s), "a", undef, "c\n"' I don't know that there's much value to this change. Tony |
Migrated from rt.perl.org#134467 (status was 'open')
Searchable as RT134467$
The text was updated successfully, but these errors were encountered: