getting info from database - i've tried and tried

They have: 1,587 posts

Joined: Mar 1999

hello:

i've got a database with 5 differ arrays(?) per line, like this:

name¦email¦phone¦state¦city

there's about 50+ lines with that unique individual info.

how would i go about pulling just the email from each line and putting the emails all on a text file like this:

[email protected]
[email protected]
[email protected]

and so on

thanks in advance Wink

----------
My Site Got Hacked, Check It Out!
http://www.birminghamnet.com

Traffic-Website.com free traffic, affiliate programs, hosting, & domain names.
My Site got hacked, but i'm coming back?

He has: 150 posts

Joined: Apr 1999

This code should help you... I haven't tested it, but it should work Wink

#!/usr/bin/perl

open (DB,"/path/to/the/database.whatever");
@database=<DB>;
close (DB);

open (EMAILFILE,">/path/to/the/email.file");
foreach $line (@database) {
($name,$email,$phone,$state,$city) = split(/\¦/,$line);
print EMAILFILE "$email\n";
}
close (EMAILFILE);

He has: 150 posts

Joined: Apr 1999

Ahh! Where'd the smiley faces come from?? Sad
Let's try this again...

#!/usr/bin/perl

open (DB,"/path/to/the/database.whatever" ) ;
@database=<DB>;
close (DB);

open (EMAILFILE,">/path/to/the/email.file" ) ;
foreach $line (@database) {
($name,$email,$phone,$state,$city) = split(/\¦/,$line);
print EMAILFILE "$email\n";
}
close (EMAILFILE);

They have: 1,587 posts

Joined: Mar 1999

looks good i'll have to try.

thanks a lot Wink

----------
My Site Got Hacked, Check It Out!
http://www.birminghamnet.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.