Separate the variables with commas to put multiple data fields on the same line : Variable « 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 » Variable 




Separate the variables with commas to put multiple data fields on the same line
   
#!/usr/bin/perl -w

format WORKORDER=
itemB: @<<<<<<<<<<<<<<<<<<<<   itemC: @>>>>>>>>
$itemB, $itemC
itemA: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$itemA
Access:      @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$access
Deck: @<<    Stardate: @########.#
$deck, $stardate

.



# Open file.
open(WORKORDER, ">yourFile.txt" or die "Can't open yourFile.txt", $!;


# Output record.
$itemA = "This is a itemA";
$itemB = "itemB";
$itemC = "Low";
$access = "no";
$deck   = 17;
$stardate = 99999.4;

write WORKORDER;


# Output record.
$itemA = "This is the second";
$itemB = "itemB 2";
$itemC = "High";
$access = "Yes";
$deck   = 12;
$stardate = 99999.5;

write WORKORDER;


# Output record.
$itemA = "This is the third.";
$itemB = "itemB 3";
$itemC = "medium";
$access = "Via Jefferies Tube";
$deck   = 10;
$stardate = 95212.0;

write WORKORDER;

# Close file.
close(WORKORDER);

   
    
    
  














Related examples in the same category
1.Passing one variable with ! inside to format
2.Prints a value-field character.
3.Put a variable in the report header
4.Passing value to the format
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.