http://www.perlmonks.org?node_id=294493

joshclark has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks,

I'm writing a routine that needs to deal with bytes even when the string contains multibyte characters. "use bytes" of course does the trick but would break on pre-5.6 perl (alas, I need to be able to have this run on 5.004+). So, I need to ask the compiler to use the bytes pragma only if it exists...

I *think* this will do the trick but wanted to confirm with those who are wiser than I that I'm not missing anything important here:

BEGIN { eval {require bytes; import bytes; 1} }

Thanks for any advice!
Josh