Help for this page

Select Code to Download


  1. or download this
    ###############################
    # STRING CONCAT FUNCTION      #
    #     BY DR JONATHAN REES     #
    ###############################
    
  2. or download this
    $l = 5;        # $l defines the number of asterisks
    
  3. or download this
    &concat($l);    # calls the sub concat passing the 
            # number of concatenations in $l
    
  4. or download this
    print $i;    # prints the result
    
  5. or download this
    sub concat     {
    ...
            }
    
  6. or download this
        my $val = $_[0] + 1; 
        for ($k = 1 ; $k < $val ; $k++){ $i = $i.$sym; }
    
  7. or download this
        my $i = '';
        for (1 .. $_[0]) { $i = $i . $sym }
    
  8. or download this
    # Concatenate a number of symbols.
    
    ...
        for (1 .. $_[1]) { $i = $i . $_[0] }
        return $i;
    }