$tu ="D:\\PERL\\crc_test\\shock_api.h"; print "match:$&\n" if $res=$tu=~ m/\.c$/ ; print "match:$&\n" if $mes=$tu=~ m/\.h$/ ; if ($mes=$tu=~ m/\.h$/ or $res=$tu=~ m/\.c$/) { open FH, $tu or die "cannot open the required file :$!\n"; while ( my $line = ) { $line =~ s/\\t/ /g; } close (FH) or die "cannnot close the required file:$!\n"; } else { print "out of loop\n"; }