$data = "Johnson%Andrew%AX321%Engineer" ; if($data=~ /.*%.*%A/) { @arr=split('%', $data); print "$arr[0] $arr[1]"; }