Posted on 2006-11-20 20:48:19-08 by westbywest
Simple way of setting entire column to the same value?
I've found the current syntax of functions col_set() and sel_set() to be rather unwieldy if you wish to set all values in a column (whether entire column or just a selection) to be the same value. For example, if I make selection of records and then wish to set all entries in the "Berry" column to the value "Boysenberry" then I must use syntax like the following:
$t->select(<some criterion>); #a very unwieldy way of setting all values in a column to a specific value my @berries; for ($i=0 ; ($i < ($t->sel_len())) ; $i++) { push(@berries,"boysenberry"); } $t->sel_set("berry",\@berries);
Are there more elegant ways of setting column data?
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.