Perl

Moderators: Jonathan
Number of threads: 1236
Number of posts: 3605

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
help with split function Posted by edw888 on 29 May 2008 at 9:39 AM
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<br>Last name: $second<p>\n";

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<br>Last name: $second<p>\n";




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.