#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd pp /; my $str = 'h'; dd $str; ## "h" $str .= 'i'; dd $str; ## "hi" ## one way to write this mini-if aka ternary #~ $str .= 1 > 2 ? '; uh oh 1>2' : '; ok 1<2' ; ## same exact thing, just with more whitespace , easier to read #~ $str .= 1 > 2 #~ ? '; uh oh 1>2' #~ : '; ok 1<2' #~ ;;; ## once again the same exact thing (this time for real) ## the parens provide visual disambiguation ## and not important in this example, also disambiguation for operator precedence ## $str .= ( 1 > 2 ) ? ( '; uh oh 1>2' ) : ('; ok 1<2'); dd $str; ## "hi; ok 1<2" $str .= do { my $foo = 0; for(1..3){ $foo .= $_; } $foo; ## last statement is like "return $foo;" }; # end of do dd $str; ## "hi; ok 1<20123" __END__ "h" "hi" "hi; ok 1<2" "hi; ok 1<20123"