develooper Front page | perl.beginners | Postings from April 2002

RE: simple assignment

Thread Previous | Thread Next
From:
Nikola Janceski
Date:
April 2, 2002 12:53
Subject:
RE: simple assignment
Message ID:
1449413DA482D311B67000508B5A12F50592DFCF@NYEXCHANGE01
try this:
my($a, $b, $c) = $str =~ /\=(\d+)\,?/g;

Nikola Janceski

Science without religion is lame, religion without science is blind.
-- Albert Einstein (1879-1955) 



> -----Original Message-----
> From: Roy Peters [mailto:epeters@tellabs.com]
> Sent: Tuesday, April 02, 2002 3:43 PM
> To: beginners@perl.org
> 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 "=" 
> 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
>  
> 
> ============================================================
> The information contained in this message may be privileged 
> and confidential and protected from disclosure.  If the 
> reader of this message is not the intended recipient, or an 
> employee or agent responsible for delivering this message to 
> the intended recipient, you are hereby notified that any 
> reproduction, dissemination or distribution of this 
> communication is strictly prohibited. If you have received 
> this communication in error, please notify us immediately by 
> replying to the message and deleting it from your computer.
> 
> Thank you.
> Tellabs
> ============================================================
> 
> -- 
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> 

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About