in reply to Chat Client Paste Parser
Some quick comments:
- Your open statements should check if they succeed, something like this works: open (INPUT, $ARGV[0]) or die "Couldn't open $ARGV[0]: $!";
- Don't use a foreach loop here, this reads the whole input file into memory. You want to process the file line by line so just use while (my $line = <INPUT>)
- Take the open OUTPUT out of the loop. At the moment you are opening and closing the output file for every line you are processing, very inefficient. This is so, because open implicitly closes the file before it opens it again.
-- Hofmator
|
---|
In Section
Cool Uses for Perl