Re: simple assignment

2002-04-02 Thread John W. Krahn
Roy Peters wrote: > > I have a string of the following > > $str = "X1=1,Y1=2,Z1=3"; > > I want to assign the values to the right hand side of the "=" to 3 new > variables so the final result is > > $a=1 > $b=2 > $c=3 > > How do I get those values assigned to $a, $b, $c $ perl -le' $str = "X1

Re: simple assignment

2002-04-02 Thread Craig Sharp
Roy, I am a beginner and this code is kludgy but it works. I am sure there are other more simple ways to do this. #!/usr/bin/perl -w $str="X1=1,Y1=2,Z1=3"; ($X1A,$Y1A,$Z1A) = split (/,/, $str); $a = (split (/=/,$X1A))[1]; $b = (split (/=/,$Y1A))[1]; $c = (split (/=/,$Z1A))[1]; print "$a\n"

RE: simple assignment

2002-04-02 Thread Nikola Janceski
3 PM > To: [EMAIL PROTECTED] > Subject: simple assignment > > > gurus, > > OK, shoot me for asking a dumb question. > > I have a string of the following > > $str = "X1=1,Y1=2,Z1=3"; > > I want to assign the values to the right hand side of the &qu

Re: simple assignment

2002-04-02 Thread Chas Owens
On Tue, 2002-04-02 at 15:42, Roy Peters wrote: > gurus, > > OK, shoot me for asking a dumb question. > > I have a string of the following > > $str = "X1=1,Y1=2,Z1=3"; > > I want to assign the values to the right hand side of the "=" to 3 new > variables so the final result is > > $a=1 > $b=

simple assignment

2002-04-02 Thread Roy Peters
gurus, OK, shoot me for asking a dumb question. I have a string of the following $str = "X1=1,Y1=2,Z1=3"; I want to assign the values to the right hand side of the "=" to 3 new variables so the final result is $a=1 $b=2 $c=3 How do I get those values assigned to $a, $b, $c Thanks =