[Buffalo-pm] (no subject)

thomas lems tmlems2000 at yahoo.com
Tue Sep 7 07:17:13 PDT 2010


Good morning All,
I’m new to Perl, and i used  Perl to create a table with five columns and 30 rows.  I was able to save the output to a text file, but I’m struggling on how to keep the data in the text file cause every time I run the script I lose the previous data.
I believe the issue it’s in the Sub Save Data procedure.
Here is my Sub SaveData procedure:
sub SaveData {
  my ($file_name,$data,$rows,$cols) = @_;

  open(DATA,">$file_name") or die "$0 ERROR: write $file_name - $!"; 
  for (my $i=0;$i<$rows;$i++)
  {
    for (my $j=0;$j<$cols;$j++)
    {
      printf DATA ("<%s> ",$data->{"$i,$j"});
    }
    print DATA "\n";
  }
  close DATA;
  exit;
}
Please help!
Thanks



      


More information about the Buffalo-pm mailing list