$val = my_routine( $val ); sub my_routine { my ( $val ) = @_; if ( defined $val ) { $val =~ s/0/O/g; } return $val; }