if ( s/\s//s ) { # if we remove a space char, where "space" includes \n... tr/JAPH/0123/; # ...then do this tr/ansl/ation/ }