#!/usr/bin/perl -w use strict; use warnings; #--------------- my $total_filtered = 0; my $input_file = "$input_dir"."input".".txt"; open(CGS, "<$input_file") or die "can't open $input_file\n"; my $cgs = ; my $substring = substr($cgs, 2700000); my @array = split(//,$substring); foreach my $line (@array){ if($line =~ /0/){ $total_filtered++; } } print "$total_filtered\n";