in reply to Re^2: Seperating individual lines of a file
in thread Seperating individual lines of a file

People generally do

use strict; use warnings;

nowadays, and that's the single best piece of advice I can give you!

Also, people do

my @DATA=<ORIGFILE>;

but then they also prefer to avoid slurping in files all at once, and they iterate on the lines instead with a while loop rather than with a for one:

while (my $line=<ORIGFILE>) { # ...

In any case you have to specify '>' mode in open for writing (and '>>' for appending). More generally I recommend you to stick with the three args form of open and lexical handles, and always check the return value:

open my $in, '<', "whatever" or die "can't open `whatever': $!\n"; open my $out, '>', "whatever" or die "can't open `whatever': $!\n";