I'm trying to clean up some data and load it into a database.

One transformation I have to do is strip quotation marks from a lot of fields, so I 
did this:
   foreach my $varref (\$budgetdesc, \$thru_date, \$from_date, \$active, 
\$on_off_campus, \$old_budget, \$bregion, \$funding, \$finanalyst, \$progoffice, 
\$daterecord, \$datelastmo, \$timelastm9, \$lastmodified, \$timerectm9, \$createdby, 
\$typefunding, \$country, \$notes) {
      $$varref =~ s/"//g;                       # Strip the quotes from strings
   }

This seems to work well. I also need to rearrange the DATE data, so I tried to do this:
   foreach my $dateref (\$thru_date, \$from_date, \$daterecord, \$datelastmo) {
      my ($MM, $DD, $YY, $hh, $mm, $ss); 
      (($MM, $DD, $YY, $hh, $mm, $ss) = $$dateref) =~ m[(..)/(..)/(..) 
(..):(..):(..)]; 
      $$dateref = "$YY-$MM-$DD";
   } #for each of the date-type fields

However, this didn't seem to work. I also tried combining the second and third lines 
thusly:
      my(($MM, $DD, $YY, $hh, $mm, $ss) = $$dateref) =~ m[(..)/(..)/(..) 
(..):(..):(..)]; 

but this didn't help. I finally ended up doing it in four steps:
   if ($thru_date) {
      my ($MM, $DD, $YY, $hh, $mm, $ss) = $thru_date =~ m[(..)/(..)/(..) 
(..):(..):(..)];
      $thru_date = "$YY-$MM-$DD";
   } # if there's a through date

   if ($from_date) {
      ($MM, $DD, $YY, $hh, $mm, $ss) = $from_date =~ m[(..)/(..)/(..) (..):(..):(..)];
      $from_date = "$YY-$MM-$DD";
   } $ if there's a from date

   if ($daterecord) {
      ($MM, $DD, $YY, $hh, $mm, $ss) = $daterecord =~ m[(..)/(..)/(..) (..):(..):(..)];
      $daterecord = "$YY-$MM-$DD";
   } # if there's a daterecord

   if ($datelastmo) {
      ($MM, $DD, $YY, $hh, $mm, $ss) = $datelastmo =~ m[(..)/(..)/(..) (..):(..):(..)];
      $datelastmo = "$YY-$MM-$DD";
   } # if there's a datelastmo

So, to help me in the future, why didn't the version with references work, and can it 
be corrected to work?

Thanks for your thoughts.

-Kevin Zembower

-----
E. Kevin Zembower
Unix Administrator
Johns Hopkins University/Center for Communications Programs
111 Market Place, Suite 310
Baltimore, MD  21202
410-659-6139


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to