Extracting table names from multiple strings using perl regex : I want to extract the table names after FROM from this code :

    from DS_RAN_CORID t1, NAMON_GNS t4, NA_VAL_ROL t6, A_TI_G_V t7, PTSM_TCR t2
    left outer join T_TR_COR_LAG t3
    on  t2.inp_seq = t3.inp_seq and t3.ti_number = t2.ti_number
    left outer join OUT_TR_COR t5
    on  t2.inp_seq=t5.inp_seq and t5.ti_number=t2.ti_number
    where t1.inp_seq = t2.inp_seq and t2.ti_number = t6.interval_number and
          t1.ti_grp = t7.dm_group and t2.ti_number = t7.interval_number;
The tables i need to extract:DS_RAN_CORID/ NAMON_GNS/ NA_VAL_ROL/ A_TI_G_V/ PTSM_TCR/


I tried something like this:

1.Match the t1. , t2. etc  , this is for any letter . any digit

    $string=~m/(\S).\d/gi;

2.Assuming that my code is correct i need to compare the t1. with TABLE_NAME t1 and extract the table name with something like this:

    $string=~m/\w+\s+(S)\d/gi;