more useful options | |
PerlMonks |
Re: avoid writing 'use utf8' in every scriptby kcott (Archbishop) |
on Feb 02, 2014 at 01:52 UTC ( [id://1073013]=note: print w/replies, xml ) | Need Help?? |
G'day reqnode, What you really want may be possible; however, what you describe is illegal syntax. Consider this example script (see Note below): #!/usr/bin/env perl use utf8; sub smiley { print "Smiley\n"; } sub ☺ { print "Smiley\n"; } Here's what happens when you run this:
The documentation for the utf8 pragma even tells you this: "One can have Unicode in identifier names, but not in package/class or subroutine names." If you provide a short code example, that might serve to illustrate exactly what you're trying to achieve. [Note: I've used <pre>, instead of <code>, tags for the code containing Unicode characters. This is to allow the actual characters, instead of character entity references, to be displayed. Please do the same with any such code you post.] -- Ken
In Section
Seekers of Perl Wisdom
|
|