if (my @lines = grep{/^\d+.*\s*0\.00\s*$/}@data) change to: if (my @lines = grep{/^\d+.*\s*0\.00\s*$/..././}@data)