my $magic = 'sub { '; foreach my $char (@chars) { $magic .= "\$cnts{$char} += ()= \$_[0] =~ m/$char/g;"; } $magic .= '}'; my $magicsub = eval "$magic"; die "eval to create anon sub failed '$@'" unless defined $magicsub; while( <DATA> ) { $magicsub->($_); }
In reply to Re: Re: Re: Re: counting occurances
by shenme
in thread counting occurances
by imlou
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |