LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 02-18-2004, 10:48 PM   #1
fooforon
Member
 
Registered: Sep 2003
Posts: 37

Rep: Reputation: 15
Perl Help (possible split)


Hi, I have problems with the out of a script so i was wonder if anyone could help me

I m reading from a database that is set up by pipe only reading in persons name and favorite num

Jamie|8
Joe|45
Jessica|8
bob|7

like that for example

this is hte output of the script

Jamie|8
name: J
fav: a
Jamie|8
name: J
fav: a
Jamie|9
name: J
fav: a
Jamie|10
name: J
fav: a

this is the routine

sub readfile
{
open READ, "tst.db";

while ( $line = <READ>)
{
chomp;
print "$line<br>";
($nam1, $num1) = split (/|/, $line);
print "name: $nam1<br>";
print "fav: $num1<br>";
}


}

I dont understand why the spilt is splitting like that if someone could please help it would be grealy appeiacted

Jamie
 
Old 02-19-2004, 04:30 AM   #2
Berng
Member
 
Registered: Dec 2003
Location: Siberia,Russia
Distribution: Basically RedHat
Posts: 34

Rep: Reputation: 15
($nam1, $num1) = split (/\|/, $line);
BestRegards,
Oleg.
 
Old 02-19-2004, 05:53 AM   #3
fooforon
Member
 
Registered: Sep 2003
Posts: 37

Original Poster
Rep: Reputation: 15
Thank you for your help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
split command in perl not splitting / linuxmandrake Programming 1 11-03-2005 03:28 PM
PERL Q, split function and reg expressions amytys Programming 1 12-08-2004 10:54 AM
PERL: split on html tag? ocularbob Programming 12 09-08-2003 05:52 PM
perl string split problem! farhanali Programming 4 06-22-2003 07:08 AM
perl split(@array)?? wtf? bobjones Programming 5 09-23-2002 09:41 AM


All times are GMT -5. The time now is 05:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration