How can I print the numbers justified in Perl, for example:
a= 1 b= 22 c= 333 d=4444
Try it.
printf ("%4d\n",1); printf ("%4d\n",11); printf ("%4d\n",111); printf ("%4d\n",1111);
The official resource for this is perldoc -f sprintf , which has a good summary of examples:
perldoc -f sprintf
For instance: printf '<% d>', 12; # prints "< 12>" printf '<%+d>', 12; # prints "<+12>" printf '<%6s>', 12; # prints "< 12>" printf '<%-6s>', 12; # prints "<12 >" printf '<%06s>', 12; # prints "<000012>"
For instance:
printf '<% d>', 12; # prints "< 12>" printf '<%+d>', 12; # prints "<+12>" printf '<%6s>', 12; # prints "< 12>" printf '<%-6s>', 12; # prints "<12 >" printf '<%06s>', 12; # prints "<000012>"
Use printf with precision and a space like "filler":
printf
printf "a=% 4d\n", 1; printf "b=% 4d\n", 22;
Source: https://habr.com/ru/post/1389408/More articles:JQuery.on function unlike load event - javascriptReturn to top of UINavigationController stack when clicking a tab? - iosHow to change storage engine from InnoDB to MyISAM using RightScale - mysqlDynamically generate PDF reports with Sweave - rhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1389407/hibernate-mapping-multiple-classes-to-one-table-using-hbmxml&usg=ALkJrhg8z7jJsuJ2VwKed5vdWUGhhxYEqQLoop for case - vhdliOS: Audio IN via connector, audio output via built-in speaker - ioscaptureStillImageAsynchronouslyFromConnection: stillImageConnection completeHandler does not always receive a call - iosWhat is the difference between an ASP.NET site and a SharePoint site? - c #WebGet UriTemplate fails at point ('.' /% 2E)? - restAll Articles