Perl Basics
Introduction to Perl
FAQ's
CGI
Regular Expressions

PC Overview
Cool Stuff
My Modules
Success Stories
Links
Perl in the News
Logos
Perl @ msn
Perl Chat

PC Internals
About
Contact
Guest Book
Handy Logos
What's new

Perl Formats - Reports

Implementation
See also perlform
P-friendly

[ home ] - [ search ] - [ sitemap ]

Perl Formats - Reports

#!/usr/bin/perl -w
use strict;

use FileHandle;

#####  GLOBAL
$| = 1;
my $name = my $login = my $office = my $uid = my $gid = my $home = '';

open(OUTF, ">/tmp/test.txt") or die $!;
select(OUTF);

format OUTF_TOP =
                         Passwd File
 Name                Login    Office   Uid   Gid Home
 ------------------------------------------------------------------
.
format OUTF =
 @<<<<<<<<<<<<<<<<<< @||||||| @<<<<<<@>>>> @>>>> @<<<<<<<<<<<<<<<<<
 $name,              $login,  $office,$uid,$gid, $home
.


$name   = 'Reto M. Hersiczky';
$login  = 'foo';
$office = 'Uster';
$uid    = 471;
$gid    = 1234;
$home   = 'yourhome';
write;

$name   = 'bar';
$login  = 'yourlogin';
$office = 'Zürich';
$uid    = 47122;
$gid    = 654321;
$home   = 'myhome';
write;

close OUTF;

Output

[root@reto adm2002]# cat /tmp/test.txt
                         Passwd File
 Name                Login    Office   Uid   Gid Home
 ------------------------------------------------------------------
 Reto M. Hersiczky v   foo    Uster    471  1234 yourhome
 bar                 yourlogi Zürich 47122 65432 myhome
home - feedback - search - web jobs
© 1998-2004 retoh :)