Paul Kraus wrote at Mon, 07 Jul 2003 09:27:15 -0400:

> What's an easy way to grab just one element out of a function that
> returns a list.
> 
> For instance if I was to stat a file and all I wanted was the $atime or
> if I just wanted the three timestamps atime mtime and ctime. Thanks.

A completely different way that works in the special case of stat, would be

my ($atime, $mtime, $ctime) = (-A $file, -M _, -C _);

That also only calls once the stat function, but is a bit more intuitiv,
as indexing them with [8,9,10] from the stat returning list.

Read perldoc perlvar for details.


Greetings,
Janek

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

Reply via email to