in reply to Re: How do I capture the last character in a string?
in thread How do I capture the last character in a string?

Yet another way:

#!/usr/bin/perl -w use strict; my $str = "hello, world!"; my $result = substr($str,length($str)-1,1); print $result;

PS: Surprisingly, length($str)-- doesn't work for me, but length($str)-1 does.

Leonid Mamtchenkov aka TVSET