"John W. Krahn" wrote:
>
> #!/usr/bin/perl -w
> use strict;
> use CGI qw/:standard/;
>
> print header;
>
> my @arrayStuff = (
> { OutFile => 'albu.htm',
> PageId => '3.4.1.5.1',
> Menu => 'albu_menu.inc',
> Content => 'albu.inc'
> },
> { OutFile => 'armi.php',
> PageId => '3.4.1.5.2',
> Menu => 'armi_menu.inc',
> Content => 'armi.inc'
> },
> { OutFile => 'bank.htm',
> PageId => '3.4.1.5.3',
> Menu => 'bank_menu.inc',
> Content => 'bank.inc'
> },
> { OutFile => 'bate.htm',
> PageId => '3.4.1.5.4',
> Menu => 'bate_menu.inc',
> Content => 'bate.inc'
> } );
>
> my $fileName = '/web/schooled/www/skin.php';
> my $outFilePath = '/web/schooled/www/hscdata2';
for my $stuff ( @arrayStuff ) {
open my $fh, '>', "$outFilePath/$stuff->{OutFile}"
or die "Cannot open $outFilePath/$stuff->{OutFile}: $!";
$stuff->{Handle} = $fh;
}
> open my $fh, $fileName or die "Cannot open $fileName: $!";
> while ( my $line = <$fh> ) {
> for my $stuff ( @arrayStuff ) {
> if ( $line =~ /^(.*?)<!-- pageId here -->(.*)\z/s ) {
> print {$stuff->{Handle}} $1, $stuff->{PageId}, $2;
> }
> elsif ( $line =~ /^(.*?)<!-- menu here -->(.*)\z/s ) {
> print {$stuff->{Handle}} qq[$1<? include "$stuff->{Menu}"; ?>$2];
> }
> elsif ( $line =~ /^(.*?)<!-- content here -->(.*)\z/s ) {
> print {$stuff->{Handle}} $1, $stuff->{Content}, $2;
> }
> else {
> print {$stuff->{Handle}} $line;
> }
> }
> }
> close $fh;
>
> __END__
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]