You can make use of split function without any delimiter, so that split occurs after each character.
-
while(<FILE>) {
-
my @chars = split // ;
-
print $chars[0];
-
}
-
Better approach would be to use a regular expression as below:
-
while(<FILE>) {
-
print $1 if(/^(.)/); # take out the first character
-
}
-