Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: searching for clear ways to overwrite the empty string

by graff (Chancellor)
on Apr 20, 2016 at 00:38 UTC ( #1160954=note: print w/replies, xml ) Need Help??


in reply to Re: searching for clear ways to overwrite the empty string
in thread searching for clear ways to overwrite the empty string

That's neat -- and it could be done like this to make sure that both "undef" and "empty string" are handled without warnings:
$_ //= "?" or s/^\z/?/ for ( $this_variable, $that_variable, $another_ +variable );
(UPDATE: But I'm inclined to think that when there's a problem with too many long variable names, it might mean that those variable names really ought to be keys in a hash.)

(updated again to fix the mis-typed operator in the snippet.)

Replies are listed 'Best First'.
Re^3: searching for clear ways to overwrite the empty string
by Anonymous Monk on Apr 20, 2016 at 00:54 UTC

    Parens not needed.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1160954]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2021-02-27 04:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?