Except that it doesn't solve the problem I actually asked about. Like I said, I don't want an array, I want normal variables.-hh wrote:So, three lines of LC-code. At least not more than your perl-code.
(groan)-hh wrote:By the way, you could try and read a bit more the dictionary.
The first two do not work:-hh wrote:For example
put "variable1,variable2,variable3" into theList or
put "variable1","variable2","variable3" into theList or
put (variable1,variable2,variable3) into theList (variable values)
just work. No createList() needed.
Code: Select all
put "apples" into fruit1
put "berries" into fruit2
put "cherries" into fruit3
-- Returns the literal, "fruit1, fruit2, fruit3", not the values:
put "fruit1, fruit2, fruit3" into theList
-- Returns the literal, "fruit1, fruit2, fruit3", not the values:
put "fruit1","fruit2","fruit3" into theList
-- Returns "apples, berries,cherries":
put (fruit1, fruit2, fruit3) into theList
However, I'm pretty confident that that's nowhere to be found in the Dictionary, or any of the LiveCode documentation for that matter. I'm willing to stand corrected if someone can point out otherwise.
Returning to the first problem, here's how I can do it in Perl:
Code: Select all
$data = 'Dave,46,sr. engineer,colorado,23';
($name, $age, $title, $city, $code) = split(',',$data);
Code: Select all
put 'Dave,46,sr. engineer,colorado,23' into data
split data by comma
put data[1] into theName
put data[2] into age
put data[3] into title
put data[4] into city
put data[5] into theCode