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

Building/defining variables from an value in string

Thread Next
From:
Ravi Malghan
Date:
April 22, 2008 14:09
Subject:
Building/defining variables from an value in string
Hi: I have a string with a number of variable name, type and value pairs. I want to split the field and build my variables. Below is an example

$string = "field1,int,10#field2,string,abc";
@values = split(/#/,$string);

I want to get two variables from the string, equivalent to the below statements
$field1=10;
$field2="abc";

TIA.
Ravi



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About