Help for this page

Select Code to Download


  1. or download this
    for (@arr1) {  #for each element in @arr1
        s/\s+$//;  #replace one or more spaces at the end of it
                   #with nothing (deleting them)
    }
    
  2. or download this
    for (@arr1) {
        while ( substr($_,-1,1) eq ' ' ) {  # while the last char is space
           chop();                          # remove the last char
        }
    }
    
  3. or download this
    for (@arr1) { chop() while substr($_,-1,1) eq ' ' }