No idea what the problem is, but you probably shouldn't be setting $IE to the Win32::OLE object and then immediately overwriting it with the Win32::IEAutomation object. You may also want to chomp(@lines) to
remove the newlines, depending on what SetValue is expecting. Consider enabling warnings, too.