print (1 ? 1 : 0) . 'x'

Jonathan McKeown jonathan at hst.org.za
Thu May 11 13:54:09 BST 2006


On Thursday 11 May 2006 12:07, David Dorward wrote:
> On Thu, May 11, 2006 at 10:59:01AM +0100, O'Shaughnessy, Jamie wrote:
> > print (1 ? 1 : 0) . 'x';
> >
> > What do you expect this would print?
>
> 1
>
> Since it is the same as:
> print( (1 ? 1 : 0) ) . 'x';
>
> Using warnings would have told you that print (...) was "interpreted
> as function" and complain about "Useless use of concatenation (.) or
> string in void context".

and
use diagnostics;

gives you even more helpful hints, including a pointer to the manpage (perlop)

Jonathan


More information about the london.pm mailing list