Front page | perl.beginners |
Postings from April 2002
Re: simple assignment
Thread Previous
From:
Chas Owens
Date:
April 2, 2002 12:51
Subject:
Re: simple assignment
Message ID:
1017780437.2622.8.camel@tert.icallinc.com
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=2
> $c=3
>
> How do I get those values assigned to $a, $b, $c
>
> Thanks
>
$str = "X1=1,Y1=2,Z1=3";
($a,$b,$c)=($1,$2,$3) if $str =~ /X1=(\d+),Y1=(\d+),Z1=(\d+)/;
--
Today is Boomtime the 19th day of Discord in the YOLD 3168
Frink!
Missile Address: 33:48:3.521N 84:23:34.786W
Thread Previous