#!/usr/local/apps/perl/bin/perl ############################################################################# # # # WHO: John L. Moreland # # # # WHAT: format # # # # WHY: Demonstrates the use of the Perl "format" statement. # # Prints the /etc/passwd file out in a tabular format. # # # # WHERE: Opus Software # # # # WHEN: Mon Sep 21 20:25:53 PDT 1998 # # # # HOW: PERL # # # ############################################################################# format MyTop = UserName UID GID Real Name Home Shell -------- ----- ----- ----------------- ----------------------- --------- . format MyBody = @>>>>>>> @#### @#### @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<< @info[0,2..6] . select( ( select(STDOUT), $^ = 'MyTop', $~ = 'MyBody')[0] ); $= = 60; open( PASSWD, " ); close( PASSWD ); foreach $user ( sort @users ) { @info = split( /:/, $user ); $info[4] =~ s/[,-].*//; write; }