Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Formatting output

by cjf (Parson)
on Jun 13, 2002 at 12:15 UTC ( #174157=note: print w/ replies, xml ) Need Help??


in reply to Formatting output

chomp the input from /etc/passwd to remove the newlines, splitting into an array is much cleaner in my opinion. Checking your open calls and using strict and warnings is also good practice.

#!/usr/bin/perl -w use strict; open INPUT, "</etc/passwd" or die "Can't open file #!\n"; my @lines; while (<INPUT>) { chomp; @lines = split /:/; write(); } format STDOUT_TOP = NAME ID ---- -- . format STDOUT = @<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<< $lines[0], $lines[4] .

Also, what systems is it failing on, what errors does it give?.


Comment on Re: Formatting output
Download Code
Re: Re: Formatting output
by Anonymous Monk on Jun 13, 2002 at 13:19 UTC
    I need to find out what system it is on. Thanks for the input and I will try it out when the system is back up.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://174157]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2015-07-06 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls