Perl/Shell Knowledge Sharing
Perl Interview Questions and Answers
Wednesday, December 29, 2010
Character increment in perl
Method 1:
$char = "C";
$char = (ord($char)+1);
print chr $char;
Method 2:
for ( $i=26, $c='a' ; $i ; $i--, $c=chr(ord($c)+1) ) { printf("$c\n"); }
Method 3:
print ++($foo = 'A');
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment