in reply to avoid writing 'use utf8' in every script
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:
$ pm_script_with_utf8.pl Illegal declaration of anonymous subroutine at ./pm_script_with_utf8.p +l line 9.
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: avoid writing 'use utf8' in every script
by Jim (Curate) on Feb 02, 2014 at 02:30 UTC | |
by roboticus (Chancellor) on Feb 04, 2014 at 11:34 UTC | |
|
Re^2: avoid writing 'use utf8' in every script
by tobyink (Canon) on Feb 02, 2014 at 11:01 UTC | |
|
Re^2: avoid writing 'use utf8' in every script
by reqnode (Novice) on Feb 02, 2014 at 02:12 UTC |