edeca | Hrm. More infernal questions, mainly because I am trying to make my perl prettier and contain less nasty if's. I have $foo and $bar which are obtained from split(/ /, 'kitten loving'). But I don't want undef if the split fails, I'd rather '' for $bar or both. What's the nicest way to do that? |
Khisanth | ($foo, $bar) = map { $_ // "" } split / /, $str; # 5.10 version :) |
edeca | Noo 5.10! :) |
Khisanth | ($foo, $bar) = map { defined $_ ? $_ : "" } split / /, $str; # probably some other shorter ways too |
rindolf | edeca: [bad idea] you can also try using the conditional->inheritance refactoring. |
rindolf | :-) |
* Khisanth | pours boiling coffee on rindolf |
rindolf | Khisanth: I hate coffee, but I guess I deserved it. |
rindolf | That was a joke, of course. |
Khisanth | you weren't really supposed to like having boiling anything poured on you but I guess you are into the kinkier stuff |