zoukankan      html  css  js  c++  java
  • 花括号的使用 printf %${width}s , 否则会 去找 $widths

    花括号的使用  printf %${width}s , 否则会 去找  $widths

      1 #! /usr/bin/perl
      2 use strict;
      3 use warnings;
      4
      5 =head1
      6 print " ----------------------------------ch_5_Q1_-------------------------- ";
      7 #print reverse <>;
      8 print " ----------------------------------_-------------------------- ";
      9 select STDIN;
     10 my @single_quotation = <>;
     11 print @single_quotation;
     12 print " ----------------------------------ch_5_Q1_-------------------------- ";
     13 =cut
     14
     15 print " ----------------------------------ch_5_Q2_-------------------------- ";
     16 print "What column width would you like?, please input:";
     17 chomp(my $width = <STDIN>);
     18 print "Enter some lines, then press Ctrl-D: "; # or Ctrl-z
     19 my @underscore;
     20 chomp(@underscore = <STDIN>);
     21 #@underscore = <STDIN>;
     22 #print " "."1234567890"x7,"12345 ";
     23 print " "."1234567890"x (($width + 9)/10),"12345 ";
     24                          
     25 =head1                   
     26 foreach(@underscore){    
     27     #print "$_"." ";    
     28     printf "%20s ", $_;
     29 }                        
     30 =cut                     
     31                          
     32 my $semicolons = "%${width}s " x @underscore;
     33 printf "$semicolons", @underscore;
     34 print " ----------------------------------ch_5_Q2_-------------------------- ";

  • 相关阅读:
    BNUOJ-26474 Bread Sorting 逆序对
    POJ-2480 Longge's problem 积性函数
    Bzoj-2705 Longge的问题 欧拉函数
    Bzoj-2820 YY的GCD Mobius反演,分块
    HDU-4689 Derangement DP
    [转]初学者程序语言的选择
    HDU-4705 Y 树形DP
    HDU-4704 Sum 大数幂取模
    HDU-4699 Editor 数据结构维护
    HDU-4696 Answers 纯YY
  • 原文地址:https://www.cnblogs.com/books2read/p/11003874.html
Copyright © 2011-2022 走看看