![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Perl Script issue. What am I doing wrong? | SkySmart | Shell Programming and Scripting | 14 | 03-19-2009 05:22 PM |
| perl script to print to values in rows and columns | nogu0001 | Shell Programming and Scripting | 3 | 02-22-2009 04:30 PM |
| Perl script to match a pattern and print lines | ammu | Shell Programming and Scripting | 6 | 12-22-2008 04:26 AM |
| Perl Script Issue - Please Help * Thanks!!! | jroberson | Shell Programming and Scripting | 8 | 11-03-2008 03:47 AM |
| perl - why is the shell script executed before the print command? | mjays | Shell Programming and Scripting | 3 | 09-21-2007 06:49 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Perl script issue: print
Can someone tell me what I'm doing wrong with my perl script? I am new to Perl. This isn't even the final script, I'm just testing to see if it will print the directories with the files in it. For some reason my output is only printing the 1st, 6th, and last entries of the @sub_dir array. Each of the sub_dir folders has 4 test files in it (Test1-4.txt). My intent is to ultimately copy multiple files from source to destination--since perl won't let me do it as easily as in shell. TIA ![]() Code:
#!perl.exe
use strict;
use File::Copy;
my @sub_dir = ("sqr","src","user","nvision","winword","crw","excel","maint","projects","scripts","data");
my $source = "C:\\Test";
my $destination = "C:\\Test2";
foreach (@sub_dir)
{
my $dir1 = glob($source . "\\" . $_ . "\\*");
my $dir2 = glob($destination . "\\" . $_);
print "$dir1\n";
}
Here is my output: C:\Scripts>perl refresh_test.pl C:\Test\sqr\Test1.txt C:\Test\sqr\Test2.txt C:\Test\sqr\Test3.txt C:\Test\sqr\Test4.txt C:\Test\crw\Test1.txt C:\Test\crw\Test2.txt C:\Test\crw\Test3.txt C:\Test\crw\Test4.txt C:\Test\data\Test1.txt |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|