darrengan has asked for the wisdom of the Perl Monks concerning the following question:
Need help on array.
i have this file with the following content:
name;address1;address2;postcode;state;country
i have this code to get the array
open(RESULT,"file") || die "EXECUTION ERROR : Fail to open"; while (<RESULT>) { chop(); $REC = $_; @LINEREC = split(/\;/,$REC); print "LINEREC[0]\n"; } close RESULT;
Understood that it will print "name". If i want to do the reverse that is print the LINEREC [ ? ] value, how do i do it?
Example: I want to know "postcode" fall in which array. and the script should print "LINEREC[ 3 ]"
Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: get array number
by ikegami (Patriarch) on Jan 20, 2006 at 06:22 UTC | |
by ikegami (Patriarch) on Jan 20, 2006 at 16:20 UTC | |
by Fletch (Bishop) on Jan 20, 2006 at 14:16 UTC | |
|
Re: get array number
by helphand (Pilgrim) on Jan 20, 2006 at 06:14 UTC | |
by darrengan (Sexton) on Jan 20, 2006 at 06:24 UTC | |
by Sioln (Sexton) on Jan 20, 2006 at 08:55 UTC | |
by helphand (Pilgrim) on Jan 20, 2006 at 06:34 UTC | |
by smokemachine (Hermit) on Jan 20, 2006 at 07:50 UTC |