This piece of code works, but it has a redundant pattern in it. Every time I try to create a variable "my $pRole = qr/Assistant|Executive|Senior//;" to replace the redundant patterns, it stops working. It has something to do with the "gi" qualifiers for the patterns. Can someone edit this code to use the variable $pRole instead of multiple occurrences of /Assistant|Executive|Senior/?
Thanks, Siegfried #!c:\Perl\bin\perl.exe # Begin commands to execute this file using Perl with bash # ./test.pl # End commands to execute this file using Perl with bash my $sJobTitle = "Wanted: Senior Assistant for Corporate Executive"; while(my @m = $sJobTitle =~ /Assistant|Executive|Senior/gi){ $sJobTitle =~ s/Assistant|Executive|Senior//i; print __LINE__. " m=[".join(",",@m)."]\n"; $x{$m[0]} = 0; } print $sJobTitle."(".join(",",sort keys %x).")\n"; It prints the following: cd c:/WinOOP/Perl/bots/yahoo/finance/ ./test.pl 10 m=[Senior,Assistant,Executive] 10 m=[Assistant,Executive] 10 m=[Executive] Wanted: for Corporate (Assistant,Executive,Senior) Compilation finished at Tue Jun 07 10:27:32 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>