Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi bopibopi, Your code has a couple of issues: You don't check your open calls for errors (open(...) or die $!;), you seem to have a typo on the line print fh1 $_; (should be $fh1), and They were just set on read, is there a way to change this from inside the code? I'd recommend you don't, because write-protection is supposed to be exactly that! Someone someday (including you) might set a file to read-only for a good reason and the script would clobber it anyways. I recommend you output a descriptive error message instead, e.g. die "I can't write to $filename\n" unless -w $filename; (see -X). But if you must ("just enough rope" and all that), there's chmod. Hope this helps, P.S. Just saw stevieb and linuxer were a little faster than me on several points :-) In reply to Re: Perl - Remove duplicate based on substring and check on delimiters
by haukex
|
|