You want to use the substr()
function.
$shortened = substr( $long, 0, 50 ); # 50 characters long, starting at the beginning.
For more, use perldoc
perldoc -f substr
In your case, it would be:
$str="abcd";
$short = substr( $str, 0, 3 );
You want to use the substr()
function.
$shortened = substr( $long, 0, 50 ); # 50 characters long, starting at the beginning.
For more, use perldoc
perldoc -f substr
In your case, it would be:
$str="abcd";
$short = substr( $str, 0, 3 );