> I have solved my earlier question.
>
> Thanks to those who responded.
>
> the problem was:
> I have an input file which contains n rows with 3 items in each row:
> 1 2 3
> a b c
> 4 5 6
>
> The script output needs to take the items from each row and print them
> as:
> "v1=1, v2=2, v3=3"
> "v1=a, v2=b, v3=c"
> "v1=4, v2=5, v3=6"
>
> the script looks like this:
>
> foreach (@parameters){
> my $line=$_;
> ($v1,$v2,$v3) = split (/ /,$line);
> print "v1=$v1\n";
> print "v2=$v2\n";
> print "v3=$v3\n";
> }
This would actually give the following output
v1=1
v2=2
v3=3
v1=a
v2=b
v3=c
v1=4
v2=5
v3=6
you are printing a new line character after each variable. At most, you will
only need it after the third value. You will not need it at all if you did
not chomp the newline off of each line of the file when you read them into
the array "@parameters"
What you would want is:
foreach (@parameters){
my $line=$_;
($v1,$v2,$v3) = split (/ /,$line);
print "v1=$v1, v2=$v2, v3=$v3\n"; #if you chomped each line.
print "v1=$v1, v2=$v2, v3=$v3"; #if you didn't.
}
>
>
>
>
> --------------------------------------------------------------------
> Dean Paulson
> Systems Test Engineer (972) 202-8164
> Xalted Networks www.xipn.net
> 2901 Dallas Parkway
> Suite 200
> Plano, TX 75093-5982
>
> Xalted NetworksTM - Proprietary and Confidential.
> Do not copy, reproduce or disclose to other persons
> without the prior written consent of XaltedNetworks.
> --------------------------------------------------------------------
> "We are living in the future, I'll tell you how I know.
> I read it in a paper, fifteen years ago."
> - John Prine
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]