#!/usr/bin/perl -w use strict; use warnings; use diagnostics; open(REPORT, $ARGV[0]) || die("Error - Can't open $ARGV[0]: $!\n"); our $initial_datetime; our $backlog; while () { last if /,-/; chomp; ($initial_datetime, $backlog) = split(","); $backlog =~ s/^\s+//; # just for testing purposes print $initial_datetime; print "\n"; print $backlog; print "\n"; }