On Fri, Sep 25, 2009 at 5:46 AM, Shawn H Corey <shawnhco...@gmail.com> wrote:
> Robert Citek wrote:
>>
>> How does one transliterate in perl using a negated character class?
>
> echo "abcxyz" | perl -ple '$_ =~ tr/abz/N/c'
>
> See `perldoc perlop` and search for /tr\/SEARCHLIST\/REPLACEMENTLIST\/cds/

Thanks.  I took a little break from coding which helped clear my mind.
 That and your reference to the right doc section (instead of an
overly vague RTFM) reminded me that I wanted s/// not y///.

$ echo "abcxyz" | perl -ple '$_ =~ s/[^abz]/N/g'

Regards,
- Robert

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to