Saturday, October 18, 2008

Change the case to upper and lower

#!/usr/bin/perl -w

$str="Dasuntha";

$sub=substr $str, 2, 4;

print($sub."\n");

#convert the Uppercase

$Uppercase=uc $str;

print($Uppercase."\n");

#convert case of the first letter
$fcase=ucfirst $str;

print($fcase."\n");

$lcase=lcfirst $str;

print($lcase."\n");


#convert the Lowercase

$Lowercase=lc $str;

print($Lowercase."\n");

#chop -get the last letter
$ch=chop $str;

print($ch."\n");

No comments: