Re: looping issue



dakin999 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??

Please clarify what "this" means.

Possibly you mean that you want to look up a value in "file_name" for each $row. That would indicate that you ought to store the file data in a hash variable.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages

  • Re: looping issue
    ... foreach my $row { ... The problem is in the looping of input that I need to read for ... payment of page charges. ...
    (comp.lang.perl.misc)
  • looping issue
    ... foreach my $row { ... The problem is in the looping of input that I need to read for ... to pick a new line from for each $row entry. ...
    (comp.lang.perl.misc)
  • Re: regex help
    ... foreach ... chomp; ... open (pkgREPO, '<', 'data/versions-list.txt') ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • Re: regex help
    ... my @newValues; ... foreach ... chomp; ... open (pkgREPO, '<', 'data/versions-list.txt') ...
    (perl.beginners)
  • Re: OT: a problem about text manipulation
    ... use strict; ... use warnings; ... foreach my $item { ...
    (Fedora)