1. Split
The split function splits up a string and places it
into an array. T
Example:
--------
$sentence= "Best regards and have a nice day .. ";
@its_array = split(/a/, $sentence);
ouputs:
Best regards and have a nice day ..
We cam also write:
$_= "Best regards and have a nice day .. ";
@its_array = split(/a/);
2. substr
To substring, as an example, we can use the followinigs:
$sentence= "Best regards and have a nice day .. ";
substr($sentence, 2, 6); (from 3d to 6th character from the 3d)
returns "st reg"
substr($sentence, 5); (from the 5th to the end of the sentence)
returns "regards and have a nice day .. "
substr($sentence, -9, 4); (from 9th from the end and the 4th from the 9th)
returns "e da"
|