Hi Peter,
>From looking at your example data, it looks like your column seperator is
white space, what you could do is use the split function (see perlfunc
manpage). An example implementation would be someting like.
open (FILE, "<myfile.file") or die "can't seem to open your file matey";
while (<FILE>) { #read in file a line at a time
my ($column2) = (split())[1]; #this bit splits on whitespace, the default
behavior when no arguments are used
#and chooses the second item returned
by list, the first would be in (split())[0]
#
# do something with column2 here
#
}
exit 0;
anyway, hope this helps somewhat
regards
Ahmer Memon
-----Ursprungliche Nachricht-----
Von: Peter Lemus [mailto:[EMAIL PROTECTED]]
Gesendet: 20 April 2001 17:28
An: [EMAIL PROTECTED]
Betreff: How to read the second column of a file
Hi, guys,
I need to read a huge two column file; I only need the
data from the second column; I need to asign it a
variable to that column, for example $FILE, how do go
about doing this; I appreciate your help.
the file looks like this
md tony
md ariba
md arpa
I will have a loop going over and reassingn the next
name to the same variable.
thanks,
=====
Peter Lemus
Computer Networks Engineer
[EMAIL PROTECTED]
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/