sub meld_columns { my (@cols_to_meld) = @_; my ($ctm, $arrnm, $aline); my @outarray; # "local" needed for the following vice "my" because # the indirect references [$$ctm] require access to # the global symbol table and "my" variables are not # in the global symbol table. local ($a, $b, $c, $d, $e, $f, $g, $h); # Set column indicators all to -1 (eol) $a = $b = $c = $d = $e = $f = $g = $h = "-1"; # then set the ones we are processing to 0 foreach $ctm (@cols_to_meld) { $$ctm = 0; } while (($a >= 0)||($b >= 0)||($c >= 0)||($d >= 0)||($e >= 0)||($f +>= 0)||($g >= 0)||($h >= 0)) { $aline = ''; foreach $ctm (@cols_to_meld) { $arrnm = 'out_'."$ctm"; if (($$ctm <= $#$arrnm) && ($$ctm ne "-1")) { $aline .= "$$arrnm[$$ctm]\t"; $$ctm++; $$ctm = "-1" if ($$ctm > $#$arrnm); } else { $aline .= "\t\t"; $$ctm = "-1"; } } $aline =~ s/(.*)\t$/$1/; # get rid of trailing tab push @outarray, ("$aline"); } return @outarray; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: my vs. local subtlety
by davidrw (Prior) on Jul 03, 2006 at 16:57 UTC | |
Re: my vs. local subtlety
by esr (Scribe) on Jul 03, 2006 at 23:35 UTC | |
Re: my vs. local subtlety
by esr (Scribe) on Jul 03, 2006 at 19:21 UTC | |
by davidrw (Prior) on Jul 03, 2006 at 19:39 UTC | |
by ysth (Canon) on Jul 03, 2006 at 22:24 UTC |