[Bioperl-l] $id && $self->display($id)

Mike Schuh schuh at farmdale.com
Thu Mar 31 16:14:24 EST 2005


>I wonder what does it means in the following
>$id && $self->display($id)

Pretty standard Perl construct.  The value of $id is checked and if it is 
"true" (defined and not zero), then the display method of the current 
object is called.

This is shorthand for

 if(defined($id) && $id) {	# to be slightly pedantic

Similar patterns are used in shell scripts, etc.

Mike Schuh -- Seattle, Washington USA

More information about the Bioperl-l mailing list