For completeness, unpack should probably be put on the long list of other ways to do it.
my $str="hello world\n"; my $lchar=unpack('A1',$str); print "$lchar \n";
In reply to Re: What's the best way to get first character of the string?
by mandog
in thread What's the best way to get first character of the string?
by karmas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |