use strict; use warnings; my $string = join('x', ('a')x20); my @foo = split('x', $string); my $foo = pop(@foo); print "Success!\n" if $foo eq "a";