PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Louis Proyect <lnp3 at columbia dot edu>
Subject: follow-up question
Date: Feb 10 2000 9:46PM

I implemented the suggestion that Michael offered, but there is something
that still puzzles me. In the example below, the hour and minute is altered
successfully in the foreach loop, but not in the first case. Is there any
way to get the first example to work? If there really is no loop to
process, I don't see a need for a foreach structure, even though it does
seem to work in this case.

#!/usr/local/bin/perl
use Sybase::CTlib;
 
$dbh = Sybase::CTlib->ct_connect('xxx', 'yyy');
 
 
$date = "20000210";
$convert = "select new_date = (convert(smalldatetime, '$date'))";
@res = $dbh->ct_sql($convert);
 
### this returns nothing
$date1 = join(" ", @$res[0]);
$date1 =~ s/12:00AM/11:59PM/g;
print "$date1\n";

### this prints the proper converted date and alters the hhmm 
foreach $row (@res)
  {$date2 = join(" ", @$row);
   $date2 =~ s/12:00AM/11:59PM/g;
   print "$date2\n";}