Re: looping issue
- From: xhoster@xxxxxxxxx
- Date: 30 Jun 2008 16:28:51 GMT
dakin999 <akhilshri@xxxxxxxxx> wrote:
Hi, I have following code:
foreach my $row (@$array_ref) {
my ( $usr, $usr_det, $pwd_val) = @$row;
#print "\tuser id :$usr\n";
#print "\tcard no :$usr_det\n";
#print "\tpasswd :$pwd_val\n";
open (FILE, "<file_name") || die "Could not open the file: $!";
while (<FILE>) {
chomp;
(my $nusr_id) = split(); #read into a variable
--
--
--
}
}
The problem is in the looping of input <FILE> that I need to read for
each $row. Basically there can be more than 1 $row values and I need
to pick a new line from <FILE> for each $row entry.
Any suggestions for doing this??
It looks like you are trying to join the array and the file. But you have
hidden what the join condition is behind the "--", which greatly limits
the specificity of the advice we can give. Most likely, something should
be put into a hash. Whether that is the contents of @$array_ref or
the contents of file_name, I can't tell based on what you have given us.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
.
- References:
- looping issue
- From: dakin999
- looping issue
- Prev by Date: Re: Thread or threads.
- Next by Date: NDBM support
- Previous by thread: Re: looping issue
- Next by thread: editing smb.conf (INI files)
- Index(es):
Relevant Pages
|