in reply to perl cgi-bin script

You had
$part = @array[$antal];
in your code, which is a "no no". The correct syntax should be
$part = $array[$antal];
I double checked your code, and confirmed with my observation. Your original code of @array[$antal] created a slice, and you were assigning a list into a scalar.

Replies are listed 'Best First'.
Re: Re: perl cgi-bin script
by BUU (Prior) on Nov 15, 2003 at 04:07 UTC
    While you are correct in that it is a stylistic error, I'm quite certain that piece of code does what is expected. It is in fact returning an array slice, but since the expression in the brackets is a scalar the array slice is only one element and it is simply treated as a scalar.
    C:\WINNT\Fonts>perl -e"@x=qw/foo bar qux/; $_=@x[1]; print" bar