For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > December 2005 > syntax error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author syntax error
Thom Hehl

2005-12-03, 6:55 pm

OK, I'm getting an error running my perl script and can't seem to see
the problem. Here's the error:

syntax error at C:\src\rex\rex_config.cgi line 544, near "$sysnamelist["
syntax error at C:\src\rex\rex_config.cgi line 546, near "} elsif"
Execution of C:\src\rex\rex_config.cgi aborted due to compilation errors.

....
$SYSNAME='SysName';
$SEPARATOR='!';

$SysIndex = 0;

if ($PageNo==1)
{
my @sysnamelist=split(/$SEPARATOR/,$config{$SYSNAME});
my $sysnamelist[$SysIndex]=$input{$SYSNAME}
;
$config{$SYSNAME}=join(/$SEPARATOR/,$sysnamelist);
} elsif ($PageNo==2)

Thom Hehl
Heavyweight Software for Heavyweight Needs
www.heavyweightsoftware.com
--
"In every revolution, there is one man with a vision."--Jerome Bixby


Charles K. Clarkson

2005-12-03, 6:55 pm

Thom Hehl <mailto:thom@nowhereatall.com> wrote:

: $SysIndex = 0;
:
: if ($PageNo==1)
: {
: my @sysnamelist=split(/$SEPARATOR/,$config{$SYSNAME});
: my $sysnamelist[$SysIndex]=$input{$SYSNAME}
;

Remove the "my".

$sysnamelist[$SysIndex] = $input{$SYSNAME};


: $config{$SYSNAME}=join(/$SEPARATOR/,$sysnamelist);
: } elsif ($PageNo==2)

HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


Ecocode

2005-12-03, 9:55 pm

* thom@nowhereatall.com (Thom Hehl) wrote:
|
| my $sysnamelist[$SysIndex]=$input{$SYSNAME}
;

why do you need 'my' here ?

--
Eco
http://www.ecocode.net
* Life is wonderful with Emacs and Perl *
Purl Gurl

2005-12-04, 3:55 am

wrote:

> I'm getting an error running my perl script and can't seem to see
> the problem.


> my $sysnamelist[$SysIndex]=$input{$SYSNAME}
;


$sysnamelist[$SysIndex]=$input{$SYSNAME}
;

Remove the lexical my declaration for your array element.

Give thought to why you cannot declare an array element
as a private variable.

Purl Gurl
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com