Multiline fields : Field « Report « Perl

Home
Perl
1.Array
2.CGI
3.Class
4.Data Type
5.Database
6.File
7.GUI
8.Hash
9.Language Basics
10.Network
11.Regular Expression
12.Report
13.Statement
14.String
15.Subroutine
16.System Functions
17.Win32
18.XML
Perl » Report » Field 
Multiline fields
   

#!/usr/bin/perl

use warnings;
use strict;

my $name = 'Tom';
my $letters = 'AAA';
my $phone = '(111)111-1111';
my $itemA = <<'DONE';
Line 
Line 2. 
DONE
write();

$name = 'Jack';
$letters = 'AAA';
$phone = '(222)222-2222';
$itemA = <<'DONE';
Line 3
Line 4
Line 5
DONE
write();

$name = 'Mary';
$letters = 'CCC';
$phone = '';
$itemA = 'my item.';
write();

format STDOUT =
Name: @<<<<<<<<<<<<<<<<<<<  itemA:   ^<<<<<<<<<<<<<<<<<<<<<
      $name,                           $itemA 
letters: @<<<<<                        ^<<<<<<<<<<<<<<<<<<<<<<<<
        $letters,                      $itemA
phone: @||||||||||||                   ^<<<<<<<<<<<<<<<<<<<<<<<<~
       $phone,                         $itemA
~                                      ^<<<<<<<<<<<<<<<<<<<<<<<<
                                       $itemA
~                                      ^<<<<<<<<<<<<<<<<<<<<<<<<
                                       $itemA
~                                      ^<<<<<<<<<<<<<<<<<<<<<...
                                       $itemA
                                         
.

   
    
    
  
Related examples in the same category
1.Format Field Types
2.Split a long field over multiple lines
3.Field Designator Symbols
4.Field Display Symbols
5.Different types of fields
6.Writes a string using the multiline field format.
7.Using value fields to print output.
8.Valid value-field formats.
9.Limitations of the @* value field.
10.A program that uses a value field that does formatting.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.