in reply to Re^3: Counting iterations of 1 and 0
in thread Counting iterations of 1 and 0

Well something is working right because I got no errors.

However, nothing was written to either file.

This is the code now.

use warnings; use strict; use autodie; open IN, "<D:\\baseline_pattern.txt"; binmode IN; my @content = <IN>; close IN; foreach my $num (qw/0 1/) { my @count = ("@content" =~ /$num+/sg); open my $fh, ">iterations_$num.txt"; print $fh "$_\n" for @count; close $fh; }

Should the '>' in front of iterations be a '>>' for appending?

How can I fully qualify where the files are that data should be written?

I can barely make sense of what is going on in this script