Paul.

   Stat is a Operator and not function and the operand to stat is a
filehandle, or an expression that evalutes to a filename. As the old rule
says "If you use the parentheses, the simple (but occasionally surprising)
rule is this: It LOOKS like a function, therefore it IS a function, and
precedence doesn't matter. Otherwise it's a list operator or unary operator,
and precedence does matter.

Hope this makes sense.

-----Original Message-----
From: Paul Kraus [mailto:[EMAIL PROTECTED]
Sent: Monday, July 07, 2003 6:52 AM
To: 'Jenda Krynicky'; [EMAIL PROTECTED]
Subject: RE: Stat() - Getting one element


Ok I understand this but why the need for enclosing the function call in
().

Thanks for the info.

Paul

-----Original Message-----
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]
Sent: Monday, July 07, 2003 9:38 AM
To: [EMAIL PROTECTED]
Subject: Re: Stat() - Getting one element


From: "Paul Kraus" <[EMAIL PROTECTED]>
> 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.

$atime = (stat($file))[8];

($atime, $mtime, $ctime) = (stat($file))[8,9,10];

HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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


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



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

Reply via email to