print "Enter the Comma Separated Text...:"; $str = ; chomp($str); #Remove the quotes $str=~s/"//g; # @arr now contains the individual values @arr=split(",",$str); for($i=0;$i<=$#arr;$i++){ # if the array contains only digits if($arr[$i]=~/^d+$/){ $arr[$i]=$arr[$i]/2; } } print "Values in the Array are as Follows\n"; #print that Array foreach $val(@arr){ print "$val\n"; }