in reply to What's the best way to get first character of the string?
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"; [download]