Re: [Boston.pm] catenation of undef with string, 2 cases
Uri Guttman <uri-X/[email protected]>
| Newsgroups | gmane.comp.lang.perl.perl-mongers.boston |
|---|---|
| Organization | Perl Hunter |
| Message-ID | <[email protected]> |
On 11/09/2016 02:04 PM, Bill Ricker wrote:
> I think Uri and Ricky have it nailed.
>
> You can
> wrap with do{ no warnings; ... } or
> protect the concatenation with 42 . ($b//q()); or equivalent ?: or or
> use $b .= 42 ; if order doesn't matter (it usually does, though)
> or initialized $b to '' instead of undef, knowing it will be
> concatenated (but in that case be sure it's tested for Truth not
> Definedness)
>
>
just to add on, i use .= so often. i like to build up strings and then
return the whole string. i never initialize them to '' as i know .=
works without warning. this is true for scalars and data structures as i
said before. any lvalue undef can be used in this way.
uri