G::Tools H2v
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Summary
G::Tools::H2v - Perl extension for blah blah blah
Package variables
No package variables defined.
Included modules
G::Messenger
SelfLoader
SubOpt
Inherit
AutoLoader Exporter
Synopsis
  use G::Tools::H2v;
  blah blah blah
Description
Stub documentation for G::Tools::H2v was created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.
Blah blah blah.
Methods
DESTROY
No description
Code
_csv_h2v
No description
Code
_h2v
No description
Code
Methods description
None available.
Methods code
DESTROYdescriptionprevnextTop
sub DESTROY {
    my $self = shift;
}
_csv_h2vdescriptionprevnextTop
sub _csv_h2v {
    my $infile = shift;
    my $outfile = shift;
    my @array = ();
    my $i = 0;
    my $j = 0;

    open(INFILE, $infile) || die ("$!");
    while(<INFILE>){
	chomp;
	$array[$i] = [split(/,/)];
	$i ++;
    }
    close(INFILE);

    &h2v(\@array);

    open(OUTFILE, '>' . $outfile) || die ("$!");
    foreach my $ref (@array){
        foreach my $cell (@$ref){
            print OUTFILE $cell . ',';
	}
	print OUTFILE "\n";
    }
    close(OUTFILE);

    return 1;
}
_h2vdescriptionprevnextTop
sub _h2v {
    my $ref_array = shift;
    my $i = 0;
    my $j = 0;
    my @array = ();
    my $maxcol = 0;
    my $maxrow = 0;
 
    for ($i = 0; defined($ref_array->[$i][$j]); $i ++){
	for ($j = 0; defined($ref_array->[$i][$j]); $j ++){
	    $array[$j][$i] = $ref_array->[$i][$j];
	}
	$maxcol = $j if ($maxcol < $j);
	$j = 0;
    }
    $maxrow = $i;
 
    for ($i = 0; $i <= $maxrow; $i ++){
        @$ref_array->[$i] = ();
        for ($j = 0; $j <= $maxcol; $j ++){
            $ref_array->[$i][$j] = $array[$i][$j] if (defined($array[$i][$j]));
        }
        $j = 0;
    }
 
    return 1;
}
General documentation
AUTHORTop
A. U. Thor, a.u.thor@a.galaxy.far.far.away
SEE ALSOTop
perl(1).