Jenda Krynicky wrote:
> From: Tony Esposito <[EMAIL PROTECTED]>
> > I can resolve a constant in a print statement like so:
> >
> > use constant QX12_FILE => "q_x12_in.dat";
> > ...
> > print STDERR "could not change permissions on file @{[ QX12_FILE ]}:
> > $!";
> >
> > but how to resolve the constant when being used in a function call,
> > like so:
> >
> > use constant QX12_FILE => "q_x12_in.dat";
> > ...
> > rename(@{[ QX12_FILE ]}, "foo.dat");
> >
> > The print() works - resolves - ok....the rename() does not. I assume
> > it has something to do with the syntax of @{[ QX12_FILE ]}.
>
> You are doing it unnecessarily complex.
>
> rename( QX12_FILE, "foo.dat");
>
> is enough.
Also, if your constant is a simple scalar then you can use this instead:
print STDERR "could not change permissions on file ${\QX12_FILE}: $!";
which is a little neater, or
print STDERR "could not change permissions on file " . QX12_FILE . ": $!";
which is prhaps tidiest of all.
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]