Satya Devarakonda wrote:
> 
> Hi,

Hello,

> How can I pass an array to a function and  get values back in it??? Here
> are excerpts from my code.
> ########################################################
> sub getTimeInfo
> {
> my $sec = 0;
> my $min = 0;
> my $hour = 0;
> my $day = 0;
> my $mon = 0;
> my $year = 0;
> my $IsDST = 0;
> my $week_day = 0;
> my @time_info = "\n";
> my $day_of_year = 0;
> 
> ($sec,$min,$hour,$day,$mon,$year,$week_day,$day_of_year,$IsDST) =
> localtime(time);
> my @monName =
> ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" );
> my @dayName =
> ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
> 
> $mon += 1;
> $year += 1900;
> $results[0] = "$monName[${mon}-1]${day}";
> 
> if ( $day < 10 )
> {
>       $day = "0${day}";
> }
> $results[1] = "$year$mon$day";
> 
> $results[2] = "\"$mon\/$day\/$year\",\"${dayName[$week_day]}\", \n";
> 
> print "Satya - @results";
> return "@results";
> } #End of getTimeInfo ()
> #########################################################
> use strict;
> use Net::FTP;
> use Time::Local;
> 
> #Get Time Information to be used to call different functions
> my @results;
> 
> @results = split (/ /, getTimeInfo(), 3);
> my $MonthDay  = $results[0];
> my $ccyymmdd  = $results[1];
> my $FormattedDate = $results[2];
> 
> print "Satya1 - $MonthDay : $ccyymmdd : $FormattedDate \n";
> ######################################################
> 
> Satya1 - Dec18 : 20021218 :
> "12/18/2002","Wednesday",27480969643208615188651398403761002
> And why am I getting junk(I believe it is pointer information) at the the
> end like  ==== > 27480969643208615188651398403761002



use strict;
use Net::FTP;
use Time::Local;

{   my @monName = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
    my @dayName = qw(Sunday Monday Tuesday Wednesday Thursday Friday
Saturday);

sub getTimeInfo {
    my ( undef, undef, undef, $day, $mon, $year, $week_day ) =
localtime;
    $year += 1900;
    return sprintf( '%s%02d', $monName[$mon], $day ),
           sprintf( '%04d%02d%02d', $year, $mon + 1, $day ),
           sprintf( qq["%02d/%02d/%04d","%s"\n], $mon + 1, $day, $year,
$dayName[$week_day] );
    }
}
#########################################################
#Get Time Information to be used to call different functions

my ( $MonthDay, $ccyymmdd, $FormattedDate ) = getTimeInfo();

print "Satya1 - $MonthDay : $ccyymmdd : $FormattedDate \n";




John
-- 
use Perl;
program
fulfillment

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

Reply via email to