Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Tie::File is driving me crazy

by Dandello (Scribe)
on Feb 01, 2011 at 19:25 UTC ( #885604=note: print w/ replies, xml ) Need Help??


in reply to Re: Tie::File is driving me crazy
in thread Tie::File is driving me crazy

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.


Comment on Re^2: Tie::File is driving me crazy
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://885604]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2014-09-20 10:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (158 votes), past polls