Regex:
$string =~ m!^(.).+$!;
my $first = $1;
Split:
my @list = split('', $string); # I can't recall if '' works
$list[0]; # but I think that is right.
Really funky:
$string = reverse($string);
my $char = chop $string;
# and if you need the string intact still
$string .= $char;
$string = reverse($string);
There is more than one way to do it.
In reply to Re: first char of string?
by Anonymous Monk
in thread first char of string?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |