in reply to Renaming multiple files with unique identifiers

There is no scalar variable $PLL_name, only the array. Do not use the same name for an array and a scalar, it only confuses humans.

Possible solution:

#!/usr/bin/perl use warnings; use strict; use diagnostics; use File::Copy; my @IDI_names = ('I:\Production\TEST\P001.txt', 'I:\Production\TE +ST\P002.txt'); my @PLL_names = ('I:\Production\TEST\ISBN_Text.txt', 'I:\Production\TE +ST\ISBN2_Text.txt'); for my $idx (0 .. $#IDI_names) { my $IDI_name = $IDI_names[$idx]; my $PLL_name = $PLL_names[$idx]; copy($IDI_name, $PLL_name); }

Perl is not a shell. There is no need to double quote single scalar variables.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Renaming multiple files with unique identifiers
by reedkm (Initiate) on Aug 26, 2013 at 20:53 UTC

    Excellent, this does work. Thank you. And I take your point about naming--it was confusing.