networktestinggenius.tk
Your networking tutor
Exclusive networking testing notes
Learn Networking & Testing topics

String Operations
chop - remove the last character from a string
chr - get character this number represents
hex - convert a string to a hexadecimal number
index - find a substring within a string
lc - return lower-case version of a string
lcfirst - return a string with just the next letter in lower case
length - return the number of bytes in a string
oct - convert a string to an octal number
q/STRING/ - singly quote a string
qq/STRING/ - doubly quote a string
reverse - flip a string or a list
rindex - right-to-left substring search
substr - get or alter a portion of a stirng
tr/// - transliterate a string
uc - return upper-case version of a string
ucfirst - return a string with just the next letter in upper case
y/// - transliterate a string
$name = "Prabhu Narayanan";
print chr(35);
print "\n";
chop($name);
print "$name\n";
print lc($name);
print "\n";
print lcfirst($name);
print "\n";
print length($name);
print "\n";
print hex(A);
print "\n";
print oct(0760);
print "\n";
print(q(Prabhu Narayanan));
print "\n";
print(qq(Prabhu Narayanan));
print "\n";
print scalar reverse ($name);
print "\n";
$pos = rindex($name, h);
print $pos;
print "\n";
print substr($name, 1,2);
print "\n";
op:
#
Prabhu Narayana
prabhu narayana
prabhu Narayana
15
10
4
Prabhu Narayanan
Prabhu Narayanan
anayaraN uhbarP
4
ra