in reply to ?: (conditional operator)
perl -e '$x="\nYo "; print ($x ? $x.="hello" : $x.="Bye");' => 'Yo hel +loBye' perl -e '$x="\nYo "; print ($x ?($x.="hello") : ($x.="Bye"));' => 'Yo +hello' perl -e '$x="\nYo "; print ($x ? $x."hello" : $x."Bye");' => 'Yo hello +' perl -e '$x="\nYo "; print ($x ? $x."hello" : $x.="Bye");' => Can't mo +dify concatenation (.) or string in concatenation (.) or string at -e + line 1, near ""Bye")" Execution of -e aborted due to compilation errors. perl -e '$x="\nYo "; print ($x ? $x."hello" : ($x.="Bye"));' => 'Yo he +llo'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: ?: (conditional operator)
by echo (Pilgrim) on Aug 23, 2001 at 18:08 UTC |