CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: Re: How do I... User definable split character: Edit Log


Jan 12, 2001, 11:16 PM

Views: 2550
Re: How do I... User definable split character

Well, normally I guess you would be right however...

In the case of special characters (i.e. the pipe character I refered to in my initial post); the syntax is like:

$field = split /\.../, $_ is the "\" (literal?) that is causing problems.

Example: create a flatfile out of the following data:


Now, write the script to take the file and split the fields using a variable like:
$variable = "|";
$data = split /$variable/, ...


$data = split /\$variable/, ...

...bearing in mind that some characters need to have the pre-\ (like pipe characters) and some don't (like commas). I tried both; either does not work or it splits on every character.

I hope this makes sense to someone out there.

Sean Shrum

PS. I still need to clean it up but if you wnat to give the script a look, I have moved a copy of the script to my site at:

It currently is hard coded to handle the split function with "|"

PSS. This script works beautifully on my NT Intranet but after posting it to a UNIX machine (Host: I get "Internal Server Error"? I have the Unix path information in the script. Did I code the script wrong for UNIX-use? Any help in getting this script to work on UNIX would be great.

(This post was edited by S_Shrum on Jan 12, 2001, 10:44 PM)

This post has not been edited

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives