In this node it was mentioned to me that the following code I wrote:
Will needlessly ignore filenames named "..\n". This would be obviously true, since I am matching the end with $ that matches the end of a string before a newline. So to fix this I believe changing the code to:
should fix it by matching at the end of the string.
However, where exactly would this be a bug?? This would only be a bug on systems that support a newline in the filename. On windows, ( only system I have access to at the moment ) this is not an issue. You cannot create a filename with a "\n" within it.
use strict; use warnings; my $filename1 = "ap\ndd"; my $filename2 = "..\n"; open (OUT, '>', $filename1) or die "Error opening file [$filename] for write: $! -- $^E\n"; print OUT "TEST\n\nTEST\n"; close(OUT) or die "Error closing file [$filename]: $!\n";
Either filename will give an error:
. So at least in windows this would not be a bug, since you would never encounter such a filename.C:\src\re\test.pl Error opening file [.. ] for write: Invalid argument -- The filename, directory name, or volu +me label syntax is incorrect
Are there many systems that support such filenames?? I just can't see this being encountered often..
Am I missing something here??
zzSPECTREzIn reply to Filenames named "..\n" by zzspectrez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |