$ perl -e 'chomp($orig = <STDIN>); ($tmp = $orig) =~ s/[^A-Z]//g; prin
+t "Copy: $tmp\nOriginal: $orig\n";'
WeDfT
Copy: WDT
Original: WeDfT
So it's a perfectly valid element of your solution
Update: Hey, how about I actually show it in action?
use strict;
use warnings;
chomp(my $input = <STDIN>);
(my $test = $input) =~ s/[^A-Z]//g;
if ($test =~ /ABCD/) {
print "'$input' matches!\n";
}
else {
print "'$input' does not match.\n";
}
$ perl test.pl
WaFFe
'WaFFe' does not match.
$ [bwisti@w3d145 tmp]$ perl test.pl
AeBwaffleCfrenchtoastD
'AeBwaffleCfrenchtoastD' matches!
|