Converting string to array?



Hello,

I am trying to write a perl script to parse a string into an array. The
string has the fields separated by tabs. So what I want to do is read each
field into a variable so I can process the data further.

what I have is something like this;

open($rpt, $file);
while (<rpt>)
{
$line = $_;

#now what I want is something like
$field_1 = $line[0];
$field_2 = $line[1];
# of course this doesn't work so How do I do it?

}

An example string in the file might be like this.

995253 \t 1234 \t "address" \t "Name"


Thanks in advance for the help,
Sam


.



Relevant Pages

  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
    (microsoft.public.vc.mfc)
  • Re: Array Type Mismatch
    ... Dim resultAs String ... I am still somewhat confused as to why nothing is stored in the array. ... Public Function TextBoxGetLine(....arguments... ...
    (microsoft.public.access.formscoding)
  • Re: NumberFormatException:please help me......!!!
    ... Record that has string and array of double as members) and file could ... follows it on a line of the input file, you could use the String as a key to ... contain String representations of doubles. ...
    (comp.lang.java.programmer)
  • Help in Spanish translation of the description of UDFs
    ... functions of minimum / maximum values among elements of an array column. ... GETALLWORDS- Inserts the words from a string into a global dimensioned ... WORDTRAN- Searches a character string for occurrences of a first word, ... ARRAYSUM- Returns the sum of all or a specified range of numeric (and/or ...
    (microsoft.public.fox.helpwanted)