Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Yes, you definitely want to split on /\x04/ . In addition to that, there are a few places where your code could be cleaned up a little. You are declaring @LineDetails outside of your loop. Is there any reason for that? At least in your example, you only use it inside the loop, as a temp variable. You don't actually need the variable at all, to do what you need to do in this example. You are sucking the entire file into an array. This can be very memory intensive, depending on the size of the file. It can also cause your program to appear to hang when it is started. Plus, you can eliminate another variable if you read the file line by line. I would clean up everything after the open() line as follows:
One last thing, as a general security tip, you would be well advised to get used to using the 3 argument open, (i.e., open my $FILE, '<', $FileLocation in your case). In reply to Re: split a line by control ^D character
by rjt
|
|