in reply to Multiple CGI Objects w/ Same Name

You don't want to use the multiple cgi thing.. It really doesn't serve a purpose in this case.
Ok, so to get this straight, you are saving parameters across sessions and need to re-access those paramaters, keeping intact any new paramaters that come along?
Looking at save() from CGI, it basically writes a file of key=value pairs, one per line.. also, throwing other info at param() will add those key=value pairs to the list.
With that info, this might help:
#!/usr/bin/perl -Tw use CGI; my $cgi = new CGI; # show current list print "\n\n"; print join(" ",$cgi->Vars()); print "\n"; if (open(FILE, "<./saved_params.txt")) { # add saved parameters while(<FILE>) { chomp; # CGI's save() ends the file # with = alone on the last line last if $_ =~ /^=$/; # split out the key=value pair my($key, $val) = split(/=/,$_,2); # and add them to the current list $cgi->param($key=>$val); } } # show final list print "--\n"; print join(" ",$cgi->Vars()); print "\n\n"; # save final list if (open(FILE, ">./params")) { $cgi->save(FILE); close(FILE); }
I ran this from the cmd line, so it won't work as is in a web environment (no print $cgi->header in there). Also, it doesn't do any checking for a parameter that's already existing, so if the original list had like foo=bar and there was a saved foo=baz, the baz would overwrite bar (i would imagine), but that should be easy enough to check against.
Hopefully that'll help you with what you're trying to do.
-Syn0