/usr/share/perl5
NameSizeModeActions
Attribute/-0755rm
B/-0755rm
Class/-0755rm
Compress/-0755rm
Config/-0755rm
CPAN/-0755rm
DBM_Filter/-0755rm
Devel/-0755rm
encoding/-0755rm
ExtUtils/-0755rm
File/-0755rm
Getopt/-0755rm
I18N/-0755rm
IO/-0755rm
IPC/-0755rm
Locale/-0755rm
Math/-0755rm
Memoize/-0755rm
Module/-0755rm
Net/-0755rm
overload/-0755rm
Pod/-0755rm
pod/-0755rm
Search/-0755rm
Term/-0755rm
Text/-0755rm
Thread/-0755rm
Tie/-0755rm
Time/-0755rm
Unicode/-0755rm
unicore/-0755rm
URI/-0755rm
User/-0755rm
vendor_perl/-0755rm
warnings/-0755rm
AnyDBM_File.pm26180644editdlrm
AutoLoader.pm157970644editdlrm
AutoSplit.pm196370644editdlrm
autouse.pm42380644editdlrm
base.pm109610644editdlrm
Benchmark.pm310260644editdlrm
blib.pm20620644editdlrm
bytes.pm37400644editdlrm
bytes_heavy.pl7580644editdlrm
charnames.pm209310644editdlrm
CORE.pod31880644editdlrm
DB.pm189220644editdlrm
DBM_Filter.pm143850644editdlrm
deprecate.pm46030644editdlrm
diagnostics.pm192990644editdlrm
DirHandle.pm20850644editdlrm
Dumpvalue.pm176680644editdlrm
dumpvar.pl155550644editdlrm
English.pm47610644editdlrm
feature.pm190030644editdlrm
fields.pm94750644editdlrm
FileCache.pm55490644editdlrm
FileHandle.pm67840644editdlrm
filetest.pm40030644editdlrm
FindBin.pm45610644editdlrm
if.pm36110644editdlrm
integer.pm32540644editdlrm
Internals.pod25750644editdlrm
less.pm32040644editdlrm
locale.pm48550644editdlrm
Memoize.pm361920644editdlrm
meta_notation.pm21170644editdlrm
NEXT.pm189850644editdlrm
open.pm85120644editdlrm
overload.pm533020644editdlrm
overloading.pm18080644editdlrm
perl5db.pl3170940644editdlrm
PerlIO.pm144410644editdlrm
Safe.pm253640644editdlrm
SelectSaver.pm10760644editdlrm
SelfLoader.pm176860644editdlrm
sigtrap.pm87360644editdlrm
sort.pm39110644editdlrm
strict.pm47380644editdlrm
subs.pm9010644editdlrm
Symbol.pm47990644editdlrm
Test.pm300420644editdlrm
Thread.pm82890644editdlrm
UNIVERSAL.pm65940644editdlrm
URI.pm349540644editdlrm
utf8.pm104230644editdlrm
vars.pm24580644editdlrm
vmsish.pm43130644editdlrm
warnings.pm505370644editdlrm
XSLoader.pm112520644editdlrm
_charnames.pm341510644editdlrm
Edit: /usr/share/perl5/bytes.pm (3740B)
package bytes; our $VERSION = '1.07'; $bytes::hint_bits = 0x00000008; sub import { $^H |= $bytes::hint_bits; } sub unimport { $^H &= ~$bytes::hint_bits; } sub AUTOLOAD { require "bytes_heavy.pl"; goto &$AUTOLOAD if defined &$AUTOLOAD; require Carp; Carp::croak("Undefined subroutine $AUTOLOAD called"); } sub length (_); sub chr (_); sub ord (_); sub substr ($$;$$); sub index ($$;$); sub rindex ($$;$); 1; __END__ =head1 NAME bytes - Perl pragma to expose the individual bytes of characters =head1 NOTICE Because the bytes pragma breaks encapsulation (i.e. it exposes the innards of how the perl executable currently happens to store a string), the byte values that result are in an unspecified encoding. B If you feel that the functions here within might be useful for your application, this possibly indicates a mismatch between your mental model of Perl Unicode and the current reality. In that case, you may wish to read some of the perl Unicode documentation: L, L, L and L. =head1 SYNOPSIS use bytes; ... chr(...); # or bytes::chr ... index(...); # or bytes::index ... length(...); # or bytes::length ... ord(...); # or bytes::ord ... rindex(...); # or bytes::rindex ... substr(...); # or bytes::substr no bytes; =head1 DESCRIPTION Perl's characters are stored internally as sequences of one or more bytes. This pragma allows for the examination of the individual bytes that together comprise a character. Originally the pragma was designed for the loftier goal of helping incorporate Unicode into Perl, but the approach that used it was found to be defective, and the one remaining legitimate use is for debugging when you need to non-destructively examine characters' individual bytes. Just insert this pragma temporarily, and remove it after the debugging is finished. The original usage can be accomplished by explicit (rather than this pragma's implicit) encoding using the L module: use Encode qw/encode/; my $utf8_byte_string = encode "UTF8", $string; my $latin1_byte_string = encode "Latin1", $string; Or, if performance is needed and you are only interested in the UTF-8 representation: utf8::encode(my $utf8_byte_string = $string); C can be used to reverse the effect of C within the current lexical scope. As an example, when Perl sees C<$x = chr(400)>, it encodes the character in UTF-8 and stores it in C<$x>. Then it is marked as character data, so, for instance, C returns C<1>. However, in the scope of the C pragma, C<$x> is treated as a series of bytes - the bytes that make up the UTF8 encoding - and C returns C<2>: $x = chr(400); print "Length is ", length $x, "\n"; # "Length is 1" printf "Contents are %vd\n", $x; # "Contents are 400" { use bytes; # or "require bytes; bytes::length()" print "Length is ", length $x, "\n"; # "Length is 2" printf "Contents are %vd\n", $x; # "Contents are 198.144 (on # ASCII platforms)" } C, C, C, C and C behave similarly. For more on the implications, see L and L. C is admittedly handy if you need to know the B of a Perl scalar. But a more modern way is: use Encode 'encode'; length(encode('UTF-8', $scalar)) =head1 LIMITATIONS C does not work as an I. =head1 SEE ALSO L, L, L, L =cut