As you can see in the B::Deparsed code (with the output slightly formatted) the assignment is occurring outside the ?: statement. Just put parentheses around the last statement and it should work fine.shell> perl -MO=Deparse,-p - defined(%stores) ? ( $wml = join "<br/>\n",map { "<a href='$params{URL +}/op?optin&store=$_'>$stores{$_}->{'store_t_address'}</a>" }(keys + %stores) ): $wml = "Pas de résultat<br/><br/>" ; ^D Assignment to both a list and a scalar at - line 2, near ""Pas de résu +ltat<br/><br/>" ;" - had compilation errors. ((defined(%stores) ? ($wml = join("<br/>\n", map({"<a href='$params{'URL'}/op?optin&store=$_'>$stor +es{$_}{'store_t_address'}</a>";} keys(%stores)))) : $wml) = "Pas de r\351sultat<br/><br/>");
_________
broquaint
In reply to Re: the ? : operator : a bug ?
by broquaint
in thread the ? : operator : a bug ?
by Sihal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |