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_-------------------------- ";

  • 相关阅读:
    闭包
    iframe
    函数声明和函数表达式
    简单的事件委托
    onhashchange
    WebP探索
    Chrome
    适合自己学习的一些网站
    模拟jQuery的一些功能
    __autoload()方法
  • 原文地址:https://www.cnblogs.com/books2read/p/11003874.html
Copyright © 2011-2022 走看看