I'm confused. You seem to be mixing function and OO calls to CGI. I'm not sure if this is causing your problem, but it might. I've never experienced issues with cookies working with one browser and not the other.
Some things to try:
- Use all OO calls to CGI, thusly:
my $q = new CGI;
my $c = $q->Cookie(-name => 'login',
-value => $login2,
-expires => '+3M',
-domain => '.mydomain.com'
);
print $q->redirect(-cookie=>$c, -location=>$URL);
- I doubt this will mean anything, but I don't think you need the double quotes around $URL.
- You can only set a cookie for the domain that the script was requested from. . .as a security measure. If your domain is "foo.com" you can only set a valid cookie for this domain. I think you're aware of that, given the way you set your domain in your cookie. So if your redirect is to a different domain, you can't set a cookie for that domain, only the old one.
Good Luck!