in reply to Re: append files to a directory
in thread append files to a directory
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: append files to a directory
by choroba (Cardinal) on Feb 21, 2018 at 09:34 UTC | |
BTW, if you want to keep the name of the directory in a variable, don't call it $str, call it $dir. And use it everywhere. So, you can replace
with
| [reply] [d/l] [select] |
|
Re^3: append files to a directory
by shmem (Chancellor) on Feb 21, 2018 at 09:54 UTC | |
See opendir. That's for reading a directory. If you want to write files into a directory, name it. open doesn't guess, and doesn't magically prepend a path component to the file name; opendir doesn't set a directory context for open.
Better alternative to join, because it is portable (Windows etc):
update: Re-reading the question and code, it looks like you mistook opendir for chdir which sets the current working directory. Cwd comes in handy:
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
| [reply] [d/l] [select] |