develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [ID 20010821.002] bug in getpwnam

Thread Previous | Thread Next
From:
Wolfgang Laun
Date:
August 22, 2001 23:34
Subject:
Re: [ID 20010821.002] bug in getpwnam
Message ID:
3B84A3F6.E2002CE9@alcatel.at
Carsten Grohmann <carsten.grohmann@dr-baldeweg.de> wrote at Tue, 21 Aug
2001 15:49:04 +0200:

> I want to change the owner of a file by using the following command:
>   chown (getpwnam ($username))[2], (getgrnam ($groupname))[2], $destfile;
> and I get an syntax error near )[.

Because "chown (..." parses as a function name followed by the opening
parenthesis for this function call.

This is correct:
  chown( (getpwnam($username))[2], (getgrnam($groupname))[2], $destfile
);

Both [ID 20010821.003] and [ID 20010821.002] can be closed.

Cheers,
-Wolfgang

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About