I've a set of elements in an array which is read from a file.Now i want to use this array value in sql statement in in Claus
!for that i need to enclose these string by '(single quote).so I've tried with for loop to do this! is there any way to do this same opp? like any in build functions like qw...
code:
open FILE, "<tab_name.txt" or die $!;
my @tab=<FILE>;
chomp(@tab);
@tab=split(",",$tab[0]);#set of like eg:$tab[0]=asc,cdf,sad,casd,aea,aee,asdf
my @sql_str=();
foreach my $item(@tab){
$item="'".$item."'";
push(@sql_str,$item);#add comma
push(@sql_str,",");
}
pop(@sql_str);#remove lase unwanted comma
i got the desired output like 'asc','cdf','sad','casd','aea','aee','asdf'
but is there any way to do this?