in reply to File parsing question
use strict; while (<DATA>){ chomp; # Get rid of the EOL print "$_ "; # Don't forget to add a space or the records + will run into each other! print "\n" unless $_; # Print an EOL if the line is empty (=record + separator) } __DATA__ Start: afadffdafadf stuff stuff stuff stuff Close: xzy Start: afadffdafadf stuff stuff stuff stuff Close: xzy Start: afadffdafadf stuff stuff stuff stuff Close: xzy
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|