in reply to Re: Perl Syntax that we generally don't know or forget.
in thread Perl Syntax/resources that we generally don't know or forget.
Wow, I didn't know that. You can even $a="abcdef"; substr($a,2,-2) x= 3; print $a,$/; that prints abcdcdcdef. This is amazing.
And you can buy 2 cats as simple as: $_="I have 2 dogs and 9 cats.\n"; /(\d+)\s+cat/ or die; substr($_,$-[1],$+[1]-$-[1])+= 2; print; which prints `I have 2 dogs and 11 cats.'.
See also Re: cut of first char of a string.
|
|---|