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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Added character when invoking PUSH

 



S_Shrum
User

Jan 29, 2001, 10:19 AM

Post #1 of 4 (403 views)
Added character when invoking PUSH Can't Post

Me again...

I am running into a problem. I open a flatfile pipe delimited database. In a while (FILE) construct I'm CHOMP $_; in order to get rid of the carriage ruturn and then place the whole line contents into an array called @contents. This part is working ok.

After all that I PUSH the first line off the @contents array into another array called @fields. At this point however, the problem surfaces...there is a extra character at the end of the line (the last field name). I tried CHOMPing the @fields but that changed the data into '0'.

Ideas?

Sean Shrum
sean@shrum.net
www.shrum.net


cpdp
Deleted

Jan 29, 2001, 10:55 AM

Post #2 of 4 (401 views)
Re: Added character when invoking PUSH [In reply to] Can't Post

Have you tried using chop? Chop cuts off the last character of the string, where as chomp will only take off the last character if it is a line-ending character.

http://toarmino.com
Custom Perl
Database Programming


S_Shrum
User

Jan 29, 2001, 2:42 PM

Post #3 of 4 (397 views)
Re: Added character when invoking PUSH [In reply to] Can't Post

A little more debugging was needed...the CHOMP seems to be working (or the character at the end of the line is not a line breaking character. I tried using CHOP but that failed to work.

Using the SUBSTR function I am omitting the last character.

Thanx for the help.

Sean Shrum
sean@shrum.net
www.shrum.net


zanardi
journeyman

Jan 29, 2001, 7:02 PM

Post #4 of 4 (393 views)
Re: Added character when invoking PUSH [In reply to] Can't Post

Why dont you post the code so we can see what your tring to do. And find the best way to do it

My BBS

 
 


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

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