Commit | Line | Data |
---|---|---|
657b208b | 1 | package bytes; |
5bc28da9 | 2 | |
393fec97 | 3 | sub length ($) { |
657b208b | 4 | BEGIN { bytes::import() } |
393fec97 | 5 | return CORE::length($_[0]); |
5bc28da9 NIS |
6 | } |
7 | ||
579f6b36 JH |
8 | sub substr ($$;$$) { |
9 | BEGIN { bytes::import() } | |
10 | return | |
11 | @_ == 2 ? CORE::substr($_[0], $_[1]) : | |
12 | @_ == 3 ? CORE::substr($_[0], $_[1], $_[2]) : | |
13 | CORE::substr($_[0], $_[1], $_[2], $_[3]) ; | |
14 | } | |
15 | ||
16 | sub ord ($) { | |
17 | BEGIN { bytes::import() } | |
18 | return CORE::ord($_[0]); | |
19 | } | |
20 | ||
21 | sub chr ($) { | |
22 | BEGIN { bytes::import() } | |
23 | return CORE::chr($_[0]); | |
24 | } | |
25 | ||
26 | sub index ($$;$) { | |
27 | BEGIN { bytes::import() } | |
28 | return | |
29 | @_ == 2 ? CORE::index($_[0], $_[1]) : | |
30 | CORE::index($_[0], $_[1], $_[2]) ; | |
31 | } | |
32 | ||
33 | sub rindex ($$;$) { | |
34 | BEGIN { bytes::import() } | |
35 | return | |
36 | @_ == 2 ? CORE::rindex($_[0], $_[1]) : | |
37 | CORE::rindex($_[0], $_[1], $_[2]) ; | |
38 | } | |
39 | ||
5bc28da9 | 40 | 1; |