more useful options | |
PerlMonks |
Re^4: Global substitution of non-base-plane Unicode charactersby Jim (Curate) |
on Feb 24, 2014 at 04:00 UTC ( [id://1075930]=note: print w/replies, xml ) | Need Help?? |
In this case, using printf instead of print is justified and, in fact, smart. The default value of the predefined variable $\ ($OUTPUT_RECORD_SEPARATOR) is undef, which is what Peter wants and expects here. But a very surprising and potentially elusive bug can be introduced into Peter's program when the value of $\ is later changed. Using printf in this admittedly unusual way ensures that the Unicode byte order mark is never followed by any unexpected character such as newline (\n). Jim
In Section
Seekers of Perl Wisdom
|
|