in reply to Keeping form information in CGI

Writing the data to a file is one way to do it. Your problem is the open statement and the issue of precedence. You need parentheses like this:

open (ORGIDATA, ">orig") || die "Couldn't open! $!";

This will work although it is usually wise to specify a path when you open a file even if it is ./ just so you know where to look for the file. You can write it like you did if you use 'or' instead of '||'

open ORGIDATA, ">orig" or die "Couldn't open! $!";

Because the || operator binds tighter than the comma what you had was seen by perl as

open ORGIDATA, (">orig" || die "Couldn't open! $!");

whereas the comma binds tighter than or. This is a really common problem until you work out what is going on. By the way your 'if ($classid[$k] != $classid[$k-1])' compares the first element to the last element of your array when $k=0 as $k-1 = -1 and -1 is the index of the last element. I presume the @classid contains numbers only as you are using the numeric comparator. If they are strings you will need 'ne'. I only mention this because when I was new to perl it took a bit of getting used to vis:

          numeric    string
equality    ==         eq
inequality  !=         ne
sorting    <=>         cmp

Whoops getting side tracked. Hope this helps.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n\w+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print