http://www.perlmonks.org?node_id=1069608


in reply to Not getting desire output by using switch statement in Perl

Tired and should be doing homework, but...
$ perl -le '$alpha = "abcdefghijklmnopqrstuvwxyz"; $str = "This is a String"; print grep { ($_) } map { 1 + index($alpha, $_), "\n" } split //,lc($str)' __output__ 20 8 9 19 9 19 1 19 20 18 9 14 7
Perl is so fun...