Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Easy split() problem but I"m stumped...

Easy split() problem but I"m stumped...

Easy split() problem but I"m stumped...

For some reason, this code does not split the file by pipes, it splits each character into a seperate part of the array, I've also included a sample record from the file.  Any ideas?

open(READIN, "<rawdata.txt");

    $line = $_;
    @records = split(/|/, $line);
    print "\n\n@records\n\n";
    print "INSERT INTO EMP_TEST2 VALUES ((TO_DATE(\'04-DEC-2000\', \'DD-MON-YYYY\')),
                                         (TO_DATE(\'$records[1]\', \'DD-MON-YYYY\')),
                                         (TO_DATE(\'$records[2]\', \'DD-MON-YYYY\')),
                                         (TO_DATE(\'$records[13]\', \'DD-MON-YYYY\')),

Sample Record:
A|08-FEB-1985||000010|Alan|Biggs|3415 22Nd St|#5|San Francisco|CA|94110|USA|415/821-9943|04-FEB-1947|Personal Banker|800064|Deposit Sales & Service/SF|160 Spear St.| | |San Francisco|CA|94105|USA| |160 Spear|Walker,Antoinette L|David Biggs|415/431-9902

RE: Easy split() problem but I"m stumped...

oops, thx for looking, but hte pipe has to be escaped to work, so it's


boy, i feel dumb...


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close