Thank You Ramprasad, Silly me, the previous time I used this regex the fileds were tab delimited. It's been a long day her in Sydney Town, my concentration is starting to waver.
Regards Colin -----Original Message----- From: Ramprasad [mailto:[EMAIL PROTECTED]] Sent: Friday, December 20, 2002 21:12 To: [EMAIL PROTECTED]; Johnstone, Colin Cc: '[EMAIL PROTECTED]' Subject: Re: Perl and arrays just one mistake in the code Your elements are comma seperated and you are doing @data = split( /\t/, $element); do a @data = split( /,/, $element); ----- Ram Colin Johnstone wrote: > Gidday all, > > I want to create an array and then remove elemnets one at a time and split on the >comma. > > I've tried this with no success.. > > #!/usr/bin/perl -w > > print "Content-Type: text/html\n\n"; > > my @arrayStuff; > > $arrayStuff[0] = "albu.htm,3.4.1.5.1,albu_menu.inc,albu.inc"; > $arrayStuff[1] = "armi.php,3.4.1.5.2,armi_menu.inc,armi.inc"; > $arrayStuff[2] = "bank.htm,3.4.1.5.3,bank_menu.inc,bank.inc"; > $arrayStuff[3] = "bate.htm,3.4.1.5.4,bate_menu.inc,bate.inc"; > > my $fileName = "/web/schooled/www/skin.php"; > my $outFilePath = "/web/schooled/www/hscdata2/"; > > if( ! -e $fileName){ > print "Nothing to Work with!<br>"; > } > else{ > > while( @arrayStuff ){ > $element = shift( @arrayStuff ) > @data = split( /\t/, $element); > > my $outFileName = $data[0]; > my $strPageId = $data[1]; > my $pageMenu = $data[2]; > my $pageContent = $data[3]; > > my $output = ""; > open(IN, "<$fileName") or die("Cannot open: $!"); > while( my $line = <IN>){ > $line =~ s/<!-- pageId here -->/$strPageId/; > $line =~ s/<!-- menu here -->/<? include "$pageMenu.inc"; ?>/; > $line =~ s/<!-- content here -->/$pageContent/; > $output .= $line; > } > close(IN); > > open(OUT, ">$outFilePath$outFileName"); > print OUT ($output); > close(OUT); > > print "Generating output file $outFileName<br/>"; > } > > > The output I get is:- > > Generating output file > Generating output file > Generating output file > Generating output file > > Im used to working with PHP. > > Any help appreciated, Thank You > Colin Johnstone -- 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]