John, Im sorry I didn't reply earlier it is just Monday morning here in Sydney and have just returned to work.
I have recently discovered these lists, they are great. One of the first problems I faced when I started this job only a year ago was that I had no mentors in my workplace it was just me heading up our team of two. I have stumbled along on my own with Text books in hand, while my solutions may not be the most elegant no one else knew because they worked. Now I find I have mentors from all over the World to help me grow as a programmer for whose help I am forever grateful. Long live the list! Thank You, Regards and Christmas Cheer Colin Johnstone Website Project Officer NSW Department of Education and Training Australia -----Original Message----- From: John W. Krahn [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 21, 2002 08:03 To: [EMAIL PROTECTED] Subject: Re: Perl and arrays "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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]