in reply to dont consider if (......)

The following simple regular expression solves your homework-assignment.

if ($name =~ s/^r.wpi//i) { print ("$name fits\n"); } else { print ("$name does not fit\n"); }

But it requires the following code before to make it work:

my $name = "ipw.raxwgorga"; if ((substr($name, 0,5) eq "ipw.r") && ( (sort (split(undef, substr($n +ame, 5, length($name) - 5))))[0] eq substr($name, 5,1))) { $name = "r.wpi".$name; };

Btw.: I agree to you that thinking on your own is an overrated concept; however I recommend you to use this service next time.