in reply to chomp and regexp

I won't reiterate haukex's excellent points. Instead, it's worth a mention that if you are just stripping out all characters which match (or don't match) a given set then you do not need the heavy duty regex engine at all.

use strict; use warnings; use Test::More tests => 1; my $tag = "A quick-brown fox or 3? %&)( \\\n\n"; my $want = 'a quick-brown fox or 3 '; $tag = lc $tag; $tag =~ y/a-z0-9 _+.-//cd; is $tag, $want;

Add more tests of course to make sure you cover all bases. See y/// in perldoc for more.


🦛