semio has asked for the wisdom of the Perl Monks concerning the following question:
A few months ago I submitted a piece a code and jeffa helped me out immensely by pointing me to Perltidy. Stylistically, I know I have much room for improvement. One thing I'm hoping to improve upon is the presentation of data as produced by my scripts. The following section of code presents a simple example.
and this would produce the following output:open( WEBLOG, ">$log" ); print WEBLOG "====================\n"; foreach $string (@strings) { chomp $string; $string = "$string" . " HTTP/1.0\012\012"; my $sock = IO::Socket::INET->new( PeerAddr => $host, PeerPort => $port, Proto => $proto ); print $sock "$string"; while (<$sock>) { push @page, $_; } if ( $page[0] =~ m/404/ ) { chomp $string; print WEBLOG $string; print WEBLOG "====================\n"; } @page = (); } close(WEBLOG);
I am looking for a better way to present data such as this, e.g include a document title, page numbers, and multiple columns if appropriate. Currently, my formatting skills are limited to printing a series of characters to separate the output. Is there a better way? Any assistance will be greatly appreciated.==================== GET /FOO HTTP/1.0 ==================== GET /FOOBAR HTTP/1.0 ====================
cheers, -semio
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl reports
by ignatz (Vicar) on Oct 18, 2002 at 18:10 UTC | |
|
Re: Perl reports
by Enlil (Parson) on Oct 18, 2002 at 18:08 UTC | |
|
Re: Perl reports
by gjb (Vicar) on Oct 18, 2002 at 23:58 UTC |