#!/usr/bin/perl my $str = "Hello, World!"; my $rev = ""; $rev .= substr($str, -$_, 1) for (1 ... length($str)); print $rev;