my $itemdata = OPCItemRead ($rightdata[0], $i+1); $rightdata[0]->{lastvalues}->[$i] = $itemdata->{Value}; OPCItemWrite($rightdata[0], $i+1, $rightdata[0]->{lastvalues}->[$i] + 1); #### sub OPCItemRead { my $groupdata = shift; my $itemno = shift; my $items; my $data; # reference to the hash of data returned by Read() $items = $groupdata->{grouphandle}->OPCItems(); $data = $items->Item($itemno)->Read($OPCDevice); } sub OPCItemWrite { my $groupdata = shift; my $itemno = shift; my $newvalue = shift; my $items; $items = $groupdata->{grouphandle}->OPCItems(); $items->Item($itemno)->Write($newvalue); } #### OPC::Item::Write Matrikon.OPC.DDE: Win32::OLE(0.1707) error 0x80070057: "The parameter is incorrect" in METHOD/PROPERTYGET "Write" at C:/Program Files/Perl/lib/Win32/OLE/OPC.pm line 1666 #### x $items->Item($itemno)->Read($OPCDevice) #### OPC::Item::Write Matrikon.OPC.DDE: Win32::OLE(0.1707) error 0x80070057: "The parameter is incorrect" in METHOD/PROPERTYGET "Write" at C:/Program Files/Perl/lib/Win32/OLE/OPC.pm line 1666 at C:/Program Files/Perl/lib/Win32/OLE/OPC.pm line 123 Win32::OLE::OPC::_check_error('OPC::Item::Write Matrikon.OPC.DDE') called at C:/Program Files/Perl/lib/Win32/OLE/OPC.pm line 1666 Win32::OLE::OPC::Item::Write('Win32::OLE::OPC::Item=HASH(0x22c2360)', 11) called at opccompare.pl line 542 main::OPCItemWrite('HASH(0x2291d14)', 5, 11) called at opccompare.pl line 151 main::(opccompare.pl:154): if (not($debug =~ m/quiet/)) { #### Write(VALUE) Write VALUE to this item.