help with split function - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

help with split function

edw888edw888 Posts: 1Member
Is it possible to use a form to decide how many fields there are in a database. The reason is that i have several databases with different field counts and it would be great not to have to go into the script and change split line according to what file i use.

Example: I know there are 3 fields in database1.txt and those fields are seperated by the pipe delimiter. Can I type "first,second,third" in a form named fields and have it inserted in the split function.

($$FORM{'fields'}) = split(/|/,$list);
print "First name: $first
Last name: $second


I Know there's got to be a way somehow but i can't find it. I tried all kinds of clever, ugly and unorthodox methods to do this to no avail. Came close with this. But it only shows the first field only. Any help would be appreciated. Thanks.

@kkk = "$FORM{'fields'}";
foreach $i (@kkk) {
($$i) = split(/|/,$list);
print "First name: $first
Last name: $second


Sign In or Register to comment.