Hi,
I have been playing around with two pieces of test code:
$first = "Jim";
$last = "Smith";
$fullname = $first . " " . $last;
print $fullname;
$str1 = "Jim";
$str2 = "Smith";
$long_str = "$str1 $str2";
print $long_str;
Both of these succesfully work. However when I try implementing them
in my code I get errors. Can anyone let me know what I am doing
wrong?
print "\nWhere are the files? ";
$dir = <stdin>;
chomp ($dir);
opendir (DIRECTORY, $dir) || die "cannot open directory\n";
@files = readdir (DIRECTORY);
foreach $file (@files) {
$lc_file = lc($file);
rename("$dir/$file", "$dir/$lc_file");
}
#the above works flawlessly
opendir (DIRECTORY, $dir) || die "cannot open directory\n";
@files2 = readdir (DIRECTORY);
foreach $file2 (@files2) {
$can_file = $name $file2;
rename("$dir/$file", "$dir/$can_file");
That returns:
D:\Scriptz>lc3.pl
Scalar found where operator expected at D:\Scriptz\lc3.pl line 22,
file2"
(Missing operator before $file2?)
syntax error at D:\Scriptz\lc3.pl line 22, near "$name $file2"
Execution of D:\Scriptz\lc3.pl aborted due to compilation errors.
Doing it the other way returns:
Use of uninitialized value in concatenation (.) or string at D:\Scriptz\lc3.pl l
ine 23, <stdin> line 2.
Use of uninitialized value in concatenation (.) or string at D:\Scriptz\lc3.pl l
ine 23, <stdin> line 2.
Use of uninitialized value in concatenation (.) or string at D:\Scriptz\lc3.pl l
ine 23, <stdin> line 2.
Use of uninitialized value in concatenation (.) or string at D:\Scriptz\lc3.pl l
ine 23, <stdin> line 2.
Use of uninitialized value in concatenation (.) or string at D:\Scriptz\lc3.pl l
ine 23, <stdin> line 2.
Thanks again,
I appreciate people helping me learn.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs