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]

Reply via email to