Common values in 2 columns in 2 files

Hello,

Suppose I have these 2 tab delimited files, where the second column in first file contains matching values from first column of the second file, I would like to get an output like this:

File A

1    A
2    B
3    C

File B

A    Apple
C    Cinnabon
B    Banana

I would like an output like this:

1   Apple
2   Banana
3   Cinnabon

I can write a script for this, but I would like to know how to make it in awk or perl in one line..

Thanks,
Mohamed

In awk you could:

awk 'FNR==NR{v[$1]=$2;next}{print $1"\t"v[$2]}' fileB fileA

or

awk 'FNR==NR{v[$1]=$2;next}$2=v[$2]' OFS='\t' fileB fileA

Depending on if a line should be output if no match is found from fileB