dmtelf has asked for the wisdom of the Perl Monks concerning the following question:
and here is the code snippetCouldn't make directory c\\:\\xtrafiles c\\:\\xtrafiles
any advice about where that illegal char is coming from & how to replace / with //'s?use strict; my @extrafiles = ("blah.txt","wah.txt"); &moveextrafiles(quotemeta("c:\extrafiles"),@extrafiles); exit; sub moveextrafiles { my ($dirname,@filestomove) = @_; # change \ to \\ e.g. c:\extrafiles to c:\\extrafiles $dirname =~ s#\\#\\\\#g; print "$dirname\n"; mkdir $dirname,0777 or die "Couldn't make directory $dirname\n"; # Dir created. Now move files. # print join("\n",@filestomove); }
TIA!
dmtelf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jcwren) Re: Converting all occurrences of \ to \\ oddity
by jcwren (Prior) on Sep 12, 2000 at 19:21 UTC | |
|
RE: Converting all occurrences of \ to \\ oddity
by OzzyOsbourne (Chaplain) on Sep 12, 2000 at 20:20 UTC | |
by Adam (Vicar) on Sep 12, 2000 at 20:50 UTC | |
by tye (Sage) on Sep 12, 2000 at 21:08 UTC | |
|
Re: Converting all occurrences of \ to \\ oddity
by Carl-Joseph (Scribe) on Sep 13, 2000 at 22:35 UTC | |
by cwest (Friar) on Sep 13, 2000 at 22:42 UTC |