[plug] Perl Question

Bernd Felsche bernie at innovative.iinet.net.au
Tue May 13 14:02:37 WST 2003


On Tue, May 13, 2003 at 01:53:30PM +0800, Bernd Felsche wrote:
> On Tue, May 13, 2003 at 01:51:17PM +0800, David Buddrige wrote:
> > I have a comma-delimited text file containing records, with one line per
> > record.  The fields are seperated by commas 
> > 
> > For example, one line from the text file is: 
> > 
> > 543,XB5435,0000043,ONSHORE SYSTEM (OS),CLD,Drawing,5/11/95,CX453 
> > 
> > What I want to do is to get each of these data items into a seperate
> > variable so that I can then output each field in the required manner 
> > 
> > My code thus far is: 
> > 
> > 
> > while(<>)
> > {
> > my $line_to_parse = $_;
> > # some code to parse the line 
> > 
> > # then some code to output each field individually...
> > } 
> > 
> > where the program would be run in the following way: 
> > 
> > 
> > ./myconverter.pl < mydatafile.txt > myoutputfile.txt 
> > 
> > My question: Is there a simple perl function that will pull out each field
> > value into a variable of some kind (I guess an array would be easiest),
> > where each value is seperatly accessible? 
> 
> Yes there is such a function. At least one.
> 
> :-)

Sorry... had to /split/

	man perlfunc

-- 
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ /  ASCII ribbon campaign | I'm a .signature virus!
 X   against HTML mail     | Copy me into your ~/.signature
/ \  and postings          | to help me spread!



More information about the plug mailing list