in reply to Re^2: $1 not getting applied to reg ex
in thread $1 not getting applied to reg ex
So I was right. You _are_ trying to reinvent File::Find :)
I think you want something a bit like this (but I haven't had a chance to test it)
#!/use/bin/perl use strict; use warnings; use File::Find; use File::Path; use File::Copy; @_ >= 2 or die "Usage: $0 <source_dir> <dest_dir>\n"; my ($src, $dest) = @_; find(\&do_this, $src); sub do_this { if (-d) { mkpath([$File::Find::name]); } else { my $new = $File::Find::name; $new =~ s|/$src/|/$dest/|; copy $_, $new; } }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: $1 not getting applied to reg ex
by drum1981 (Novice) on Jul 26, 2005 at 15:30 UTC | |
by davorg (Chancellor) on Jul 26, 2005 at 15:41 UTC |