a=shift;$a=~s/\\//g;$a=glob($a);$_=`cat $a`;print"Content-type: text/h
+tml\n\n"
;while(/<!--#exec cgi="([^"]*)"-->/){$a=`$1`;$a=~s/\n/<br>\n/g;
s/<!--#exec cgi="([^"]*)"-->/$a/}print;
Let's break that down. It appears that the first part is
really meant to be:
my $a= shift @ARGV;
$a =~ s#\\#/#g;
$a= glob($a);
$_= `cat $a`;
which is just Win32-specific bad Perl for:
$_= do { local($/); <> };
that is, take a file specified on the command line and read
its contents into $_.
Now the next bit translates to:
print "Content-type: text/html\n\n";
while( /<!--#exec cgi="([^"]*)"-->/ ) {
my $a= `$1`;
$a =~ s/\n/<br>\n/g;
s/<!--#exec cgi="([^"]*)"-->/$a/
}
print;
which isn't so bad. A big unflexible, sure. If you aren't
used to Perl's implicit $_, here is an alternate version:
while( $_ =~ /<!--#exec cgi="([^"]*)"-->/ ) {
my $a= `$1`;
$a =~ s/\n/<br>\n/g;
$_ =~ s/<!--#exec cgi="([^"]*)"-->/$a/;
}
print $_;
Does that help?
-
tye
(but my friends call me "Tye") |