in reply to Re^6: How to write the perl script for the following linux command?
in thread How to write the perl script for the following linux command?
Please post a self-contained, small example that reproduces the behaviour you see.
Using the below code, I cannot reproduce your problem:
#!perl -w use strict; my $sorce_direcrtory = '.'; my $new_directory = './target/'; opendir(my $dh, $sorce_direcrtory) || die $!; while(readdir $dh) { print "Found directory entry [$_]\n"; if($_ =~ /.csv/){ print qq{copy("$sorce_direcrtory/$_", "$new_directory/$_")\n}; } } closedir $dh;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: How to write the perl script for the following linux command?
by finddata (Sexton) on Mar 14, 2017 at 13:16 UTC | |
by marto (Cardinal) on Mar 14, 2017 at 13:26 UTC |