[pm-h] Perl rename bug?
G. Wade Johnson
gwadej at anomaly.org
Mon Aug 18 13:30:39 PDT 2014
On Mon, 18 Aug 2014 13:03:46 -0700
"Michael R. Davis via Houston" <houston at pm.org> wrote:
> Perl Mongers,
> Is this a bug in rename? I googled but did not find anything off the
> top.
> $ perl -e 'my @files=("x", "y"); rename(@files);'
> Not enough arguments for rename at -e line 1, near "@files)"
> Execution of -e aborted due to compilation errors.
It looks like rename has a prototype which makes it require two
scalars. Looking at the documentation for rename, it does not support a
list as a parameter, it only supports two names.
G. Wade
>
> But this works fine.
>
> $ perl -e 'my @files=("x", "y"); rename($files[0], $files[1]);'
>
> Mike
>
> mrdvt92
>
> $ perl -v
> This is perl, v5.10.0 built for x86_64-linux-thread-multi
> Copyright 1987-2007, Larry Wall
>
--
Perl isn't really about safety. It's about getting where you're going,
and enjoying the trip. It's more important to be a good driver than to
have seven feet of sponge rubber all around your car. -- Larry Wall
More information about the Houston
mailing list