rekhasri has asked for the wisdom of the Perl Monks concerning the following question:
Dear All, I have did the pattern matching for agent_id field value in one log file. After that I have stored that values from $1 to another variable called $agent_id. For some values it contains the " ( double quotes ). Then I have substituted that double quotes. After that I have tried to store the correct values into array. But in array it is storing all the values into first index itself. But I want to store each value in different index.
Sample code:
if($line =~ /^.*:agent_id=>(.+?),/){ my $agent_id=$1; my $agent_id =~ s/\"//g; my @array=$agent_id; print $array[0]; }
I want to know how to store the values in array properly like each matched string in different index. Kindly provide me the solution for this issue.
|
---|
Back to
Seekers of Perl Wisdom