home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / gnu / gawk-2.15.5-src.lha / gawk-2.15.5 / test / reverse.awk < prev    next >
Text File  |  1993-10-20  |  225b  |  14 lines

  1. #this program creates palindromic output - slightly modified from Gawk Manual
  2. {
  3.     rev($0, length)
  4. }
  5.  
  6. function rev(str, len) {
  7.     if (len == 0) {
  8.         print " ", $0
  9.         return
  10.     }
  11.     printf "%c", substr(str, len, 1)
  12.     rev(str, len - 1)
  13. }
  14.