Re: Timestamp sub

2007-12-12 Thread Gunnar Hjalmarsson
yitzle wrote: sub timestamp { my $t = localtime; return \$t; } This function stores the localtime (seconds since epoch?) in a variable $t No, seconds since epoch is not what localtime() returns and what's stored in $t. perldoc -f localtime -- Gunnar Hjalmarsson Email: http://www.gunnar

Re: Timestamp sub

2007-12-12 Thread Tom Phoenix
On 12/12/07, Henrik Nielsen <[EMAIL PROTECTED]> wrote: > Whats with the \$t in this sub? > sub timestamp { my $t = localtime; \$t } > > And what does this do? > sub timestamp { my $t = localtime; } The localtime function is documented in the perlfunc manpage. It's being used here in a scalar cont

Re: Timestamp sub

2007-12-12 Thread yitzle
In perl, the last variable in a function is returned. sub timestamp { my $t = localtime; \$t } is the same as sub timestamp { my $t = localtime; return \$t; } This function stores the localtime (seconds since epoch?) in a variable $t, then returns a reference to $t. -- To unsubscribe, e-mail