tomsk tomsk - 3 years ago 188
Perl Question

Perl - take first 16 letters from string

I have a string which contains

45f5f5ca1997b35bf09b8e0932b0d693967d0608a3c


How can I take first 16 letters of that string?

Answer Source

Strings are composed of elements called "characters" (which may or may not be bytes). To get a string that consists of the first 16 characters of another string, you can use the following:

 substr($s, 0, 16)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download