akrrs7 has asked for the wisdom of the Perl Monks concerning the following question:
a/b/c/filename1.someext
b/c/filename2.sh
d/e/f/g/filename3.exe
I need to read that file and split each line it into a path and a filename. This is my code so far:#$ps is my path separator - could be \ or / open theInputFile, $inputFile or die "Could not read from $inputFile, +program halting. \n"; while (<theInputFile>) { chomp; my $fileBeingChecked = "$_"; my $fileName = (split /\${ps}/,$fileBeingChecked)[-1]; my $path = NOT SURE WHAT TO DO HERE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: split a path/filename
by toolic (Bishop) on Dec 01, 2011 at 17:38 UTC | |
by ikegami (Patriarch) on Dec 01, 2011 at 20:43 UTC | |
|
Re: split a path/filename
by Anonymous Monk on Dec 01, 2011 at 17:51 UTC | |
|
Re: split a path/filename
by dd-b (Pilgrim) on Dec 01, 2011 at 18:38 UTC | |
by ikegami (Patriarch) on Dec 01, 2011 at 20:52 UTC | |
by afoken (Chancellor) on Dec 02, 2011 at 09:54 UTC | |
|
Re: split a path/filename
by TJPride (Pilgrim) on Dec 02, 2011 at 03:54 UTC | |
by afoken (Chancellor) on Dec 02, 2011 at 09:51 UTC | |
by TJPride (Pilgrim) on Dec 02, 2011 at 16:14 UTC |