On 10-12-20 07:04 PM, Mark M Huntress wrote:
open(XYZ,"$ARGV[0]ready.xyz");

The three argument open is preferred and always check your opens for errors.

  my $file = "$ARGV[0]ready.xyz";
  open my $xyz_fh, '<', $file or die "could not open $file: $!\n";


#while (<XYZ>) {
   #chomp($_);

  while( <$xyz_fh> ){
    chomp;

   for ($z = 0, $z<= $#sortedstart, $z++) {
     for ($i = $sortedstart[$z], $i<= $sortedend[$z], $i++) {

It's hard to determine what these for statements are doing without knowing what's in the arrays.

       if ($_ =~ /^\s+$i\s+(\D).*\s+(.+\.\d+\s+.+\.\d+\s+.+\.\d+)\s+/) {

For complex patterns, use the /x to allow whitespace in them. See `perldoc perlre` and read the section on "Modifiers"

         $count++;
         print CON " $count     $count     $1            0     $2\n";
         }
       print "\nz is $z\n";
       print "\ni is $i\n";
       }
     }



I am expecting it to cycle through several $i values and also $z values. When 
it prints the values, it only gives $z=1.

Does anyone see why this isn't working?


--
Just my 0.00000002 million dollars worth,
  Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to