Help for this page

Select Code to Download


  1. or download this
    while (my($name,$n1,$n2)=split(' ',<INFILE>) {
       # do something...
       }
    
  2. or download this
    open FILE, "< file2.txt" or die;
    my @file2= <FILE>;  # read the whole thing
    close (FILE);
    
  3. or download this
    foreach my $hit (grep /^$name\w+/, @file2) {
       my($name_2,$n1_2,$n2_2)=split(' ',$hit); # same as you did before.
       print "Found $hit\n" if $n1 == $n1_2;
       }