use IO::File; my $fh = IO::File->new(); die "File $ARGV[0] is there in the specified location but is of Zero bytes" if (-z $ARGV[0]); $ARGV[0] .= ".rpt"; $fh->open($ARGV[0], "r"); local($/); #my $data = $fh->getline; #$fh->close; while(defined($data = $fh->getline)){ if($data =~ /^\.r/){ print "This is a comment $data\n"; } if($data =~ /^\.dec/){ print "This is declared variable $data\n"; } } $fh->close;