Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

The actual working script doesn't have that in it. THIS is the real popfileb:

sub popfileb { my $countgen0 = 0; foreach my $dlp ( 0 .. $LST - 1 ) { foreach my $yb ( $dr0[$dlp] .. $dr1[$dlp] ) { my $countgen = $countgen0++ - $dr3[$dlp]; my $change = $countgen * $dr4[$dlp]; my $incrs = int( $dr2[$dlp] + $change ); my $incrsdel = int( $dr5[$dlp] + abs $change ); my $chntot = $incrsdel + $incrs; foreach my $xb ( 0 .. $total ) { #set first row; if ( $yb == 0 ) { if ( $xb < $dr2[$dlp] ) { substr $aod[0], $xb, 1, 'a'; } else { substr $aod[0], $xb, 1, 'n'; } } #set increasing rows; elsif ( $dr4[$dlp] >= 0 ) { if ( $xb < $dr5[$dlp] + $incrs ) { if ( substr( $aod[ $yb - 1 ], $xb, 1 ) eq 'd' +) { substr $aod[$yb], $xb, 1, 'd'; } else { substr $aod[$yb], $xb, 1, 'a'; } } else { substr $aod[$yb], $xb, 1, 'n'; } } #set decreasing rows; else { if ( $xb <= $chntot ) { if ( substr( $aod[ $yb - 1 ], $xb, 1 ) eq 'd' +) { substr $aod[$yb], $xb, 1, 'd'; } elsif ( substr( $aod[ $yb - 1 ], $xb, 1 ) eq ' +a' ) { substr $aod[$yb], $xb, 1, 'a'; } else { substr $aod[$yb], $xb, 1, 'n'; } } else { substr $aod[$yb], $xb, 1, 'n'; } } } #set random decreased cell; if ( $dr4[$dlp] < 0 ) { #pre-populate deletion array; my @delarray = ( 0 .. $chntot ); fisher_yates_shuffle( \@delarray ); my $cndiea = 0; foreach my $del ( 0 .. $chntot ) { if ( defined substr( $aod[$yb], $del, 1 ) && substr( $aod[$yb], $del, 1 ) eq 'd' ) { $cndiea++; } } my $cnr = $cndiea; for my $xd ( 0 .. $chntot ) { my $xda = $delarray[$xd]; if ( defined substr( $aod[$yb], $xda, 1 ) && substr( $aod[$yb], $xda, 1 ) eq 'a' && $cnr < $incrsdel ) { substr $aod[$yb], $xda, 1, 'd'; $cnr++; } } } } } return; }

It's now working.


In reply to Re^2: Tie::File is driving me crazy by Dandello
in thread Tie::File is driving me crazy by Dandello

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 09:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found