eval "tr/$var1/$var2/"; if( $@ ) { ## handle error }