Now that I have, with all of you helping, dealt with the unlink problem. I am now faced with a new problem.
I have a file, myfile.txt, that consists of various text items that are repetitive. I am trying to replace many of the repetitive items with a place holder. Here is an example of myfile.txt:
From the script under you are just replacing lines with a static line/value.
<snip>
Perhaps I am attacking this problem wrong by using hex, but it seems easier to use then text which has carriage returns, tabs, and spaces.
I don't see any reason to use hex. There is a common idiom to use when searching for repetitions/uniqueness. ## untested example :)
@array = qw(one two one three four);
for (@array) { if (defined($unique{$_}) { s/$_/replacement/; } else { $unique{$_}++; ## $unique{$_} is now defined and true. } ## and will be replaced if it comes up again
This works equally well for files, it's just a matter of s/@array/<FH>/ There *might* be a question of memory usage though, depending on the size of the file your working with.
Also, sort -u would be faster and more efficient if you have large files, but didn't need the replacement text.
Tor
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]