Execute a Perl code from the command line (substr, Python slicing)

 
$ perl -e '$a = "abcdef"; $a = substr( $a, 2, 1); print( "hello $a\n")'
hello c

 
In [1]: a = "abcdef"

In [2]: a[2:3]
Out[2]: 'c'