Monday, August 6, 2007

Format (Part 7)-- Perl Study Notes

Format (Part 7)-- Perl Study Notes

Format (Part 7)-- Perl Study Notes

 The steps to use format
 1. Define the format
 2. Loading up the data to be printed into the variable portions of the format.
 3. Invoking the format
 
 Define the format
  the syntax of the format definition
  format formathandler=   #format is the reserved word, it says it is a format definition. formathandler is the format name

  fieldline               #formatted pattern
  value_one,value_two,value_three  #the value can be scalar or expressions/functions which return the scalar variable.But pls note that if the fieldholder is type of "Filled Fields", value can just be scalar instead of expression or function.

  fieldline
  value_one,value_two,value_three
  ...        #you can add another fieldline
  ...        #you can add another value mapped above fieldline
  .          # indicate the format definition is done
 
 Example of the Format
  #the fixed text format example
  format FIXFORMAT=
  This is the string to be printed out
  .         

No comments: