in reply to print data with matching id from two different files

As you parse file2 you are neglecting to remove the quotes and the semi-colon, thus the key will never match.

Update: You aren't removing the leading "id " either. Are you sure those are tabs in your data?

Probably best to invoke item 2 from the Basic debugging checklist:

my ($testKey, $name) = split("\t", $_); print "DEBUG: key is '$testKey', name is '$name'\n";

Replies are listed 'Best First'.
Re^2: print data with matching id from two different files
by mao9856 (Sexton) on Nov 02, 2017 at 05:53 UTC

    Please excuse me I forgot to mention that I removed semicolon and inverted commas using awk. So my written code is for a file3 without semicolon and inverted commas.Yes,there is tab in file3.

      In that case the likely problem is here:

      open FILE3, "< file3" or die; while (<FILE2>) {

      As you can clearly see, you open FILE3 but try to read from FILE2 which is not opened. Running your code gives you this warning:

      Name "main::FILE2" used only once: possible typo at 1202408.pl line 14.

      which should have alerted you to this. Always address the warnings.