home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!sol.ctr.columbia.edu!news.unomaha.edu!cwis!mfuhr
- From: mfuhr@cwis.unomaha.edu (Michael Fuhr)
- Subject: Re: Help Beginner
- Message-ID: <mfuhr.728022766@cwis>
- Sender: news@news.unomaha.edu (UNO Network News Server)
- Organization: University of Nebraska at Omaha
- References: <1993Jan25.224226.15695@digibd.com>
- Date: Tue, 26 Jan 1993 04:32:46 GMT
- Lines: 21
-
- vince@digibd.com (Vince Mar) writes:
-
- >If a line of text data contains vary fields, say range from 4 to 32, what is
- >the easiest way to get every field. Any way similar to UNIX set command to
- >get $1..$n? For example: a line contains "Thu Jan 21 1993 21:22:00", I
- >suppose can use splite to know number of fields, but then how to use "for" or
- ^^^^^^
- >"while" loop to get each field assign to other variables?
-
-
- If I understand you, this is what you want:
-
- @fields = split(' ', $some_string);
- foreach $field (@fields) {
- # This loop iterates through each element in the array @fields,
- # putting the value in $field.
- }
-
- --
- Michael Fuhr
- mfuhr@cwis.unomaha.edu
-