> I am new to perl, I receive some spam email with subject like "st0ck, > 0pportunities, gr0wth...", how can I match those words with number "0" in
Something like __CODE__ use warnings; use strict; use Data::Dumper; # add to this hash to make it slower my %rep = ( 'a' => [4], 'e' => [3], 'i' => [1, '!'], 'o' => [0], # etc ); my @words = qw/stock opportunities growth/; # this generates regular expressions # you can use elsewhere for my $word (@words) { $word =~ s/$_/'(?:'. join('|', @{$rep{$_}},$_) .')'/gei for keys %rep; } print Dumper([EMAIL PROTECTED]); __END__ This will be very slow, though. HTH, Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>