in reply to Will a substitution in an if/else control structure default to $_?
What happens when you try it?
If you want to avoid an if/else for the two similar cases, you can do a substitution like this:
s/\xa0(\d)*/defined $1 ? ' ' : ''/e;
If you want to loop over several values, doing this to each of them, you can do it like this:
for ( $x, $y, $z ) { s/\xa0(\d)*/defined $1 ? ' ' : ''/e; }
That should work also for some method that returns a list, but it will die if that list contains a read-only value (such as a literal).
I don't know if this answers your question, but I hope you find it useful anyway.
|
|---|