jonnyfolk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use CGI ':standard'; my $data2="/home/users/some_path/edit/data2.txt"; my $data1 ="/home/users/some_path/edit/data1.txt"; my $data3 ="/home/users/some_path/edit/data3.txt"; my $keys; my $values; my %dbs = ( Data1 => $data1, Data2 => $data2, Data3 => $data3, ); print "Content-type: text/html\n\n"; foreach $keys (sort keys %dbs) { $values = $dbs{$keys}; print "<p><font face=\"Arial, Helvetica, sans-serif\" size=\"3\" c +olor=\"#CC0000\">$keys contents as follows:</font></p>\n"; open FILE, "$values" or die "Can't open $values: $!"; flock (FILE, 2) or die "Can't lock $values for reading: $!"; + foreach my $line (<FILE>) { chomp $line; $line =~ s/<br>/ /g; print "$line<br>\n"; } close FILE; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Increase efficiency of script
by davido (Cardinal) on Mar 20, 2004 at 07:52 UTC | |
by jonnyfolk (Vicar) on Mar 20, 2004 at 08:49 UTC | |
by davido (Cardinal) on Mar 20, 2004 at 09:02 UTC | |
|
Re: Increase efficiency of script
by Abigail-II (Bishop) on Mar 20, 2004 at 10:52 UTC | |
|
Re: Increase efficiency of script
by runrig (Abbot) on Mar 20, 2004 at 07:56 UTC | |
by davido (Cardinal) on Mar 20, 2004 at 08:48 UTC | |
by bart (Canon) on Mar 20, 2004 at 17:43 UTC | |
|
Re: Increase efficiency of script
by techy (Scribe) on Mar 20, 2004 at 22:53 UTC |