Help for this page

Select Code to Download


  1. or download this
    
    @hash{@array} = @array;
    ...
    print map "$_: $h{$_}\n", sort keys %h;
    
  2. or download this
       # run contents of "my_file" as a program 
       perl my_file 
    ...
       # command-line that prints the last 50 lines (expensively) 
       perl -e 'lines = <>; print @@lines[ $#lines .. $#lines-50' f1 f2 f3
    + ...
    
  3. or download this
     print ":1234567890:\n";
     printf ":%7s:\n", "abcdefghij";     # min width, string is longer
    ...
     print "---\n";
     printf ":%3d:\n", 3;                # min width
     printf ":%0.3d:\n", 3;              # min width with 0 padding
    
  4. or download this
     :1234567890:
     :abcdefghij:
    ...
     ---
     :  3:
     :003: