Count chars from STDIN, takes 1 command line argument that lists all characters to be counted. RegExp does all of the work
use re 'eval';$#ARGV<0&&exit 1;$s.=$_ while<STDIN>;$s=~/(?{$z=quotemeta shift@ARGV})((??{"[$z]"})(?{$c++})|.)*(?{print$c})/m;
use re 'eval';$#ARGV<0&&exit 1;$s.=$_ while<STDIN>;$s=~/(?{$z=quotemeta shift@ARGV})((??{"[$z]"})(?{$c++})|.)*(?{print$c})/m;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Char Count
by jwkrahn (Abbot) on May 03, 2009 at 18:28 UTC | |
Re: Char Count
by afoken (Chancellor) on May 05, 2009 at 08:55 UTC |
Back to
Obfuscated Code